shithub: aacenc

Download patch

ref: 30f39e1c3a362a762fe89cebfa171b6cf5119431
parent: df5d68d794da10dca8ed2723a42be44f92fb16d5
author: Fabian Greffrath <fabian@greffrath.com>
date: Wed Oct 2 07:18:28 EDT 2019

fix some cppcheck warnings in the Cfaac code

Thanks @zvezdochiot, fixes #28

--- a/common/Cfaac/CRegistry.cpp
+++ b/common/Cfaac/CRegistry.cpp
@@ -206,7 +206,7 @@
 		if(RegQueryValueEx(regKey, keyStr, NULL, NULL, (BYTE *)tempVal, &len )!=ERROR_SUCCESS ||
 			strcmpi(tempVal,valStr))
 			RegSetValueEx(regKey, keyStr, 0, REG_SZ, (BYTE *)valStr, slen);
-		delete tempVal;
+		delete [] tempVal;
 	}
 }
 //************************************************************************************************
@@ -226,7 +226,7 @@
 		if(RegQueryValueEx(regKey, keyStr, NULL, NULL, (BYTE *)tempVal, &len )!=ERROR_SUCCESS ||
 			memcmp(tempVal,addr,len))
 			RegSetValueEx(regKey, keyStr, 0, REG_BINARY, addr, size);
-		delete tempVal;
+		delete [] tempVal;
 	}
 }
 
@@ -340,14 +340,14 @@
 long	retVal;
 DWORD	size;
 
-	dest=NULL;
+	*dest=NULL;
 	if((retVal=RegQueryValueEx(regKey , keyStr , NULL , NULL, NULL, &size))==ERROR_SUCCESS)
 		if(*dest=(BYTE *)malloc(size+1))
 			retVal=RegQueryValueEx(regKey , keyStr , NULL , NULL, (BYTE *)*dest , &size);
 	if(retVal!=ERROR_SUCCESS)
 	{
-		if(dest)
-			free(dest);
+		if(*dest)
+			free(*dest);
 		if(!defData)
 			return 0;