From a8598e06240df4423aea79e659846409be6a75e9 Mon Sep 17 00:00:00 2001
From: Ander Conselvan de Oliveira <ander.conselvan-de-oliveira@nokia.com>
Date: Mon, 31 Jan 2011 14:02:13 +0200
Subject: lc/def/lcDefConv: Use Xcalloc to avoid use of uninitialized memory
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Fixed by zero'ing conv on allocation with Xcalloc. Then
close_converter works properly.

Using uninitialized value "conv->state" in call to function "close_converter"

Reviewed-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Reviewed-by: Erkki Seppälä <erkki.seppala@vincit.fi>
Signed-off-by: Ander Conselvan de Oliveira <ander.conselvan-de-oliveira@nokia.com>
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Backported-to-NX-by: Ulrich Sibiller <uli42@gmx.de>
---
 nx-X11/lib/X11/lcDefConv.c | 2 +-
 nx-X11/lib/X11/lcGenConv.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/nx-X11/lib/X11/lcDefConv.c b/nx-X11/lib/X11/lcDefConv.c
index 5860a79a5..12a48615e 100644
--- a/nx-X11/lib/X11/lcDefConv.c
+++ b/nx-X11/lib/X11/lcDefConv.c
@@ -577,7 +577,7 @@ create_conv(
     XlcConv conv;
     State state;
 
-    conv = (XlcConv) Xmalloc(sizeof(XlcConvRec));
+    conv = (XlcConv) Xcalloc(1, sizeof(XlcConvRec));
     if (conv == NULL)
 	return (XlcConv) NULL;
 
diff --git a/nx-X11/lib/X11/lcGenConv.c b/nx-X11/lib/X11/lcGenConv.c
index 37aca0c25..42d63c529 100644
--- a/nx-X11/lib/X11/lcGenConv.c
+++ b/nx-X11/lib/X11/lcGenConv.c
@@ -2647,7 +2647,7 @@ create_conv(
     XlcConv conv;
     State state;
 
-    conv = (XlcConv) Xmalloc(sizeof(XlcConvRec));
+    conv = (XlcConv) Xcalloc(1, sizeof(XlcConvRec));
     if (conv == NULL)
 	return (XlcConv) NULL;
 
-- 
cgit v1.2.3