Fixed coverity issue 1047634
authorArmin Novak <anovak@thinstuff.com>
Wed, 28 Aug 2013 13:53:50 +0000 (15:53 +0200)
committerArmin Novak <anovak@thinstuff.com>
Thu, 5 Sep 2013 10:14:31 +0000 (12:14 +0200)
winpr/libwinpr/crt/unicode.c

index 672afc1..639a5e9 100644 (file)
@@ -352,5 +352,11 @@ int ConvertFromUnicode(UINT CodePage, DWORD dwFlags, LPCWSTR lpWideCharStr, int
        if (status != cbMultiByte)
                status = 0;
 
+       if ((status <= 0) && allocate)
+       {
+               free(*lpMultiByteStr);
+               *lpMultiByteStr = NULL;
+       }
+
        return status;
 }