Fixed coverity issue 1047592

This commit is contained in:
Armin Novak 2013-08-29 10:46:44 +02:00
parent 629ac4ad28
commit d519bc3115

View File

@ -276,11 +276,14 @@ char* GetCombinedPath(char* basePath, char* subPath)
int length;
HRESULT status;
char* path = NULL;
int basePathLength;
int subPathLength;
char* subPathCpy;
int basePathLength = 0;
int subPathLength = 0;
basePathLength = strlen(basePath);
subPathLength = strlen(subPath);
if (basePath)
basePathLength = strlen(basePath);
if (subPath)
subPathLength = strlen(subPath);
length = basePathLength + subPathLength + 1;
path = (char*) malloc(length + 1);
@ -293,12 +296,12 @@ char* GetCombinedPath(char* basePath, char* subPath)
if (!subPath)
return path;
subPath = _strdup(subPath);
PathCchConvertStyleA(subPath, subPathLength, PATH_STYLE_NATIVE);
subPathCpy = _strdup(subPath);
PathCchConvertStyleA(subPathCpy, subPathLength, PATH_STYLE_NATIVE);
status = NativePathCchAppendA(path, length + 1, subPath);
status = NativePathCchAppendA(path, length + 1, subPathCpy);
free(subPath);
free(subPathCpy);
return path;
}