[PATCH 09/16] om: Fix memory leak on read_EncodingInfo error path.

Ander Conselvan de Oliveira ander.conselvan-de-oliveira at nokia.com
Wed Mar 30 06:12:02 PDT 2011


Signed-off-by: Ander Conselvan de Oliveira <ander.conselvan-de-oliveira at nokia.com>
---
 modules/om/generic/omGeneric.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/modules/om/generic/omGeneric.c b/modules/om/generic/omGeneric.c
index c78c0a9..0029093 100644
--- a/modules/om/generic/omGeneric.c
+++ b/modules/om/generic/omGeneric.c
@@ -1932,8 +1932,10 @@ read_EncodingInfo(
 	} else
             len = strlen(buf);
         font_data->name = (char *) Xmalloc(len + 1);
-        if (font_data->name == NULL)
+        if (font_data->name == NULL) {
+            Xfree(font_data);
             return NULL;
+	}
         strncpy(font_data->name, buf,len);
 	font_data->name[len] = 0;
         if (bufptr && _XlcCompareISOLatin1(bufptr, "GL") == 0)
-- 
1.7.0.4



More information about the xorg-devel mailing list