diff options
author | KWSys Robot <kwrobot@kitware.com> | 2015-08-03 17:14:14 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2015-08-03 17:17:50 (GMT) |
commit | 9a59ae5c198f7c413bcaf29f1ab107a265677b95 (patch) | |
tree | c904a09ba88c1f96cfb0886c25a25cb1df019075 /EncodingC.c | |
parent | 1feafc643b1c50fd0fa8171a4170065ca39d4d4c (diff) | |
download | CMake-9a59ae5c198f7c413bcaf29f1ab107a265677b95.zip CMake-9a59ae5c198f7c413bcaf29f1ab107a265677b95.tar.gz CMake-9a59ae5c198f7c413bcaf29f1ab107a265677b95.tar.bz2 |
KWSys 2015-08-03 (dad68c33)
Extract upstream KWSys using the following shell commands.
$ git archive --prefix=upstream-kwsys/ dad68c33 | tar x
$ git shortlog --no-merges --abbrev=8 --format='%h %s' f63febb7..dad68c33
James Johnston (1):
dad68c33 Encoding: Fix undefined behavior if out of memory.
Jean-Christophe Fillion-Robin (2):
e5c23738 SystemTools: Fix DetectFileType failure on missing file
6d83c113 SystemTools: Fix DetectFileType failure on directory
Sebastian Schuberth (1):
4db8e69f SystemTools: Implement FileIsSymlink on Windows
Diffstat (limited to 'EncodingC.c')
-rw-r--r-- | EncodingC.c | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/EncodingC.c b/EncodingC.c index ba2cec2..32b9bff 100644 --- a/EncodingC.c +++ b/EncodingC.c @@ -45,8 +45,11 @@ wchar_t* kwsysEncoding_DupToWide(const char* str) if(length > 0) { ret = (wchar_t*)malloc((length)*sizeof(wchar_t)); - ret[0] = 0; - kwsysEncoding_mbstowcs(ret, str, length); + if(ret) + { + ret[0] = 0; + kwsysEncoding_mbstowcs(ret, str, length); + } } return ret; } @@ -72,8 +75,11 @@ char* kwsysEncoding_DupToNarrow(const wchar_t* str) if(length > 0) { ret = (char*)malloc(length); - ret[0] = 0; - kwsysEncoding_wcstombs(ret, str, length); + if(ret) + { + ret[0] = 0; + kwsysEncoding_wcstombs(ret, str, length); + } } return ret; } |