Commit 7ddc5b90 authored by Alan Coopersmith's avatar Alan Coopersmith Committed by Ulrich Sibiller

_xudc_code_to_glyph: check for NULL pointer *before* writing to it, not after

parent e18ccaaa
...@@ -702,14 +702,14 @@ int *num_gi; ...@@ -702,14 +702,14 @@ int *num_gi;
_XlcCloseConverter(conv); _XlcCloseConverter(conv);
_XlcDestroyLC(lcd); _XlcDestroyLC(lcd);
*gi = (_XUDCGIInf *)Xmalloc(sizeof(_XUDCGIInf)); *gi = Xmalloc(sizeof(_XUDCGIInf));
(*gi)->charset_str = (char *)Xmalloc(strlen(charsetname)+1);
strcpy((*gi)->charset_str,charsetname);
(*gi)->glyph_index = glyph;
if(*gi == NULL){ if(*gi == NULL){
_xudc_utyerrno = 0x03 ; _xudc_utyerrno = 0x03 ;
return(_XUDC_ERROR); return(_XUDC_ERROR);
} }
(*gi)->charset_str = Xmalloc(strlen(charsetname)+1);
strcpy((*gi)->charset_str,charsetname);
(*gi)->glyph_index = glyph;
*num_gi = 1; *num_gi = 1;
return(0); return(0);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment