From 65de25205b4a83c791bbc1fc13774b4b6cdf88c7 Mon Sep 17 00:00:00 2001 From: akallabeth Date: Sat, 14 Sep 2024 20:42:07 +0200 Subject: [PATCH] [winpr,env] add missing WINPR_ATTR_MALLOC --- winpr/include/winpr/environment.h | 4 ++++ winpr/include/winpr/path.h | 10 ++++++++++ winpr/libwinpr/environment/environment.c | 2 ++ 3 files changed, 16 insertions(+) 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; }