From c17bf311f1f28f0c22e38af335fd20cb2f0ab3c6 Mon Sep 17 00:00:00 2001 From: Daniel Stenberg Date: Wed, 2 Aug 2023 13:20:08 +0200 Subject: [PATCH] tool/var: free memory on OOM Coverity detected this memory leak in OOM situation Follow-up to 2e160c9c652504e Closes #11575 --- src/var.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/var.c b/src/var.c index 70e864cf60..88f2705f68 100644 --- a/src/var.c +++ b/src/var.c @@ -154,11 +154,11 @@ static ParameterError varfunc(struct GlobalConfig *global, } /* put it in the output */ - if(curlx_dyn_add(out, enc)) { + if(curlx_dyn_add(out, enc)) err = PARAM_NO_MEM; - break; - } curl_free(enc); + if(err) + break; } } else if(FUNCMATCH(f, FUNC_B64, FUNC_B64_LEN)) {