[PATCH libX11 4/5] fix memleak in error path

walter harms wharms at bfs.de
Tue Apr 26 14:29:41 UTC 2016



free all memory on error

Signed-off-by: walter harms <wharms at bfs.de>


---
 src/xlibi18n/lcPublic.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/xlibi18n/lcPublic.c b/src/xlibi18n/lcPublic.c
index 98a7435..08122b9 100644
--- a/src/xlibi18n/lcPublic.c
+++ b/src/xlibi18n/lcPublic.c
@@ -78,7 +78,7 @@ create(
     XLCdMethods methods)
 {
     XLCd lcd;
-    XLCdPublicMethods new;
+    XLCdPublicMethods new=NULL;

     lcd = Xcalloc(1, sizeof(XLCdRec));
     if (lcd == NULL)
@@ -97,6 +97,7 @@ create(
     return lcd;

 err:
+    Xfree(lcd->core);
     Xfree(lcd);
     return (XLCd) NULL;
 }
-- 
2.1.4



More information about the xorg-devel mailing list