diff --git a/winpr/include/winpr/environment.h b/winpr/include/winpr/environment.h index c963f8c9c..cd5c1e66e 100644 --- a/winpr/include/winpr/environment.h +++ b/winpr/include/winpr/environment.h @@ -129,15 +129,19 @@ extern "C" { #endif + WINPR_ATTR_MALLOC(free, 1) WINPR_API LPCH MergeEnvironmentStrings(PCSTR original, PCSTR merge); WINPR_API DWORD GetEnvironmentVariableEBA(LPCSTR envBlock, LPCSTR lpName, LPSTR lpBuffer, DWORD nSize); WINPR_API BOOL SetEnvironmentVariableEBA(LPSTR* envBlock, LPCSTR lpName, LPCSTR lpValue); + WINPR_ATTR_MALLOC(free, 1) WINPR_API char** EnvironmentBlockToEnvpA(LPCH lpszEnvironmentBlock); WINPR_API DWORD GetEnvironmentVariableX(const char* lpName, char* lpBuffer, DWORD nSize); + + WINPR_ATTR_MALLOC(free, 1) WINPR_API char* GetEnvAlloc(LPCSTR lpName); #ifdef __cplusplus diff --git a/winpr/include/winpr/path.h b/winpr/include/winpr/path.h index 4554f49eb..975bfcf44 100644 --- a/winpr/include/winpr/path.h +++ b/winpr/include/winpr/path.h @@ -306,10 +306,20 @@ extern "C" #endif WINPR_API const char* GetKnownPathIdString(int id); + + WINPR_ATTR_MALLOC(free, 1) WINPR_API char* GetKnownPath(int id); + + WINPR_ATTR_MALLOC(free, 1) WINPR_API char* GetKnownSubPath(int id, const char* path); + + WINPR_ATTR_MALLOC(free, 1) WINPR_API char* GetEnvironmentPath(char* name); + + WINPR_ATTR_MALLOC(free, 1) WINPR_API char* GetEnvironmentSubPath(char* name, const char* path); + + WINPR_ATTR_MALLOC(free, 1) WINPR_API char* GetCombinedPath(const char* basePath, const char* subPath); WINPR_API BOOL PathMakePathA(LPCSTR path, LPSECURITY_ATTRIBUTES lpAttributes); diff --git a/winpr/libwinpr/environment/environment.c b/winpr/libwinpr/environment/environment.c index 191027c48..600b15f20 100644 --- a/winpr/libwinpr/environment/environment.c +++ b/winpr/libwinpr/environment/environment.c @@ -301,6 +301,8 @@ BOOL FreeEnvironmentStringsA(LPCH lpszEnvironmentBlock) BOOL FreeEnvironmentStringsW(LPWCH lpszEnvironmentBlock) { + free(lpszEnvironmentBlock); + return TRUE; }