diff --git a/client/common/cmdline.c b/client/common/cmdline.c index aa7b2fbc8..d7ee50cad 100644 --- a/client/common/cmdline.c +++ b/client/common/cmdline.c @@ -5276,8 +5276,15 @@ static int freerdp_client_settings_parse_command_line_arguments_int( return status; } -static void argv_free(int argc, char* argv[]) +static void argv_free(int* pargc, char** pargv[]) { + WINPR_ASSERT(pargc); + WINPR_ASSERT(pargv); + const int argc = *pargc; + char** argv = *pargv; + *pargc = 0; + *pargv = NULL; + if (!argv) return; for (int x = 0; x < argc; x++) @@ -5360,7 +5367,7 @@ static BOOL args_from_fp(FILE* fp, int* aargc, char** aargv[], const char* file, fail: fclose(fp); if (!success) - argv_free(*aargc, *aargv); + argv_free(aargc, aargv); return success; } @@ -5414,7 +5421,7 @@ static BOOL args_from_env(const char* name, int* aargc, char** aargv[], const ch cleanup: free(env); if (!success) - argv_free(*aargc, *aargv); + argv_free(aargc, aargv); return success; } @@ -5478,7 +5485,7 @@ int freerdp_client_settings_parse_command_line_arguments_ex( settings, argc, argv, allowUnknown, largs, lcount, handle_option, handle_userdata); fail: free(largs); - argv_free(aargc, aargv); + argv_free(&aargc, &aargv); return res; } diff --git a/libfreerdp/core/gateway/rpc_bind.c b/libfreerdp/core/gateway/rpc_bind.c index b9db7fcd9..528f2a1cd 100644 --- a/libfreerdp/core/gateway/rpc_bind.c +++ b/libfreerdp/core/gateway/rpc_bind.c @@ -288,6 +288,7 @@ fail: } free(bind_pdu.p_context_elem.p_cont_elem); + bind_pdu.p_context_elem.p_cont_elem = NULL; Stream_Free(buffer, TRUE); return (status > 0) ? 1 : -1; diff --git a/winpr/libwinpr/clipboard/synthetic.c b/winpr/libwinpr/clipboard/synthetic.c index 2238c3e6f..e9dfd42d0 100644 --- a/winpr/libwinpr/clipboard/synthetic.c +++ b/winpr/libwinpr/clipboard/synthetic.c @@ -355,9 +355,9 @@ static void* clipboard_synthesize_html_format(wClipboard* clipboard, UINT32 form char* utfString = ConvertWCharNToUtf8Alloc(&pSrcData.pv[1], SrcSize / sizeof(WCHAR), NULL); free(pSrcData.pv); + pSrcData.cpc = utfString; if (!utfString) goto fail; - pSrcData.cpc = utfString; } }