From 7ddc5b90f200d3df70ca744d35507799334a8d9e Mon Sep 17 00:00:00 2001 From: Alan Coopersmith Date: Fri, 8 Mar 2013 17:13:09 -0800 Subject: _xudc_code_to_glyph: check for NULL pointer *before* writing to it, not after Signed-off-by: Alan Coopersmith Backported-to-NX-by: Ulrich Sibiller --- nx-X11/lib/X11/udcInf.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'nx-X11/lib/X11/udcInf.c') diff --git a/nx-X11/lib/X11/udcInf.c b/nx-X11/lib/X11/udcInf.c index afe398cc7..eeb847657 100644 --- a/nx-X11/lib/X11/udcInf.c +++ b/nx-X11/lib/X11/udcInf.c @@ -702,14 +702,14 @@ int *num_gi; _XlcCloseConverter(conv); _XlcDestroyLC(lcd); - *gi = (_XUDCGIInf *)Xmalloc(sizeof(_XUDCGIInf)); - (*gi)->charset_str = (char *)Xmalloc(strlen(charsetname)+1); - strcpy((*gi)->charset_str,charsetname); - (*gi)->glyph_index = glyph; + *gi = Xmalloc(sizeof(_XUDCGIInf)); if(*gi == NULL){ _xudc_utyerrno = 0x03 ; return(_XUDC_ERROR); } + (*gi)->charset_str = Xmalloc(strlen(charsetname)+1); + strcpy((*gi)->charset_str,charsetname); + (*gi)->glyph_index = glyph; *num_gi = 1; return(0); } -- cgit v1.2.3