diff options
author | Alan Coopersmith <alan.coopersmith@oracle.com> | 2013-03-08 17:13:09 -0800 |
---|---|---|
committer | Alan Coopersmith <alan.coopersmith@oracle.com> | 2013-03-08 17:17:00 -0800 |
commit | 466404007f2c8f7166e4faddfea1454c5bfe1e9a (patch) | |
tree | db277e4a01527c793693c8ced6a332686ddcf9b3 /src/udcInf.c | |
parent | 47d2eff64d167b3245d346d7f38ca703be645e26 (diff) |
_xudc_code_to_glyph: check for NULL pointer *before* writing to it, not after
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Diffstat (limited to 'src/udcInf.c')
-rw-r--r-- | src/udcInf.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/udcInf.c b/src/udcInf.c index db7ad10f..b7577ac9 100644 --- a/src/udcInf.c +++ b/src/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); } |