From: Szabolcs S. <sz...@us...> - 2008-12-22 00:16:25
|
Update of /cvsroot/ntfs-3g/ntfs-3g/libntfs-3g In directory fdv4jf1.ch3.sourceforge.com:/tmp/cvs-serv22978/libntfs-3g Modified Files: unistr.c Log Message: ntfs_utf16_to_utf8, ntfs_utf8_to_utf16: check ntfs_malloc() return value Index: unistr.c =================================================================== RCS file: /cvsroot/ntfs-3g/ntfs-3g/libntfs-3g/unistr.c,v retrieving revision 1.5 retrieving revision 1.6 diff -u -d -r1.5 -r1.6 --- unistr.c 22 Dec 2008 00:11:28 -0000 1.5 +++ unistr.c 22 Dec 2008 00:16:19 -0000 1.6 @@ -485,8 +485,12 @@ if (size < 0) goto out; - if (!*outs) - *outs = ntfs_malloc((outs_len = size + 1)); + if (!*outs) { + outs_len = size + 1; + *outs = ntfs_malloc(outs_len); + if (!*outs) + goto out; + } t = *outs; @@ -666,8 +670,11 @@ if (shorts < 0) goto fail; - if (!*outs) - *outs = ntfs_malloc((shorts+1) * sizeof(ntfschar)); + if (!*outs) { + *outs = ntfs_malloc((shorts + 1) * sizeof(ntfschar)); + if (!*outs) + goto fail; + } outpos = *outs; |