summaryrefslogtreecommitdiffstats
path: root/Source/kwsys/EncodingC.c
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2015-08-03 17:17:54 (GMT)
committerBrad King <brad.king@kitware.com>2015-08-03 17:17:54 (GMT)
commit3da431379bae33374edd7c62c6f4261b4e3a663f (patch)
treef84a7c4ee33d0eb2dd2cada7329b3dbf189ca874 /Source/kwsys/EncodingC.c
parent7ac2b1256b09044b86c6bd926cc239133beab088 (diff)
parent9a59ae5c198f7c413bcaf29f1ab107a265677b95 (diff)
downloadCMake-3da431379bae33374edd7c62c6f4261b4e3a663f.zip
CMake-3da431379bae33374edd7c62c6f4261b4e3a663f.tar.gz
CMake-3da431379bae33374edd7c62c6f4261b4e3a663f.tar.bz2
Merge branch 'upstream-kwsys' into update-kwsys
Diffstat (limited to 'Source/kwsys/EncodingC.c')
-rw-r--r--Source/kwsys/EncodingC.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/Source/kwsys/EncodingC.c b/Source/kwsys/EncodingC.c
index ba2cec2..32b9bff 100644
--- a/Source/kwsys/EncodingC.c
+++ b/Source/kwsys/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;
}