From 7935972b37a30ac5937c3e253dbb7b7ae7f38ee3 Mon Sep 17 00:00:00 2001 From: Daniel Stenberg Date: Tue, 19 Jul 2022 22:32:12 +0200 Subject: [PATCH] mprintf: fix *dyn_vprintf() when out-of-memory Follow-up to 0e48ac1f99a. Torture-testing 1455 would lead to a memory leak otherwise. Closes #9185 --- lib/mprintf.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/lib/mprintf.c b/lib/mprintf.c index 1d8052dcd6..30347de250 100644 --- a/lib/mprintf.c +++ b/lib/mprintf.c @@ -1068,13 +1068,12 @@ extern int Curl_dyn_vprintf(struct dynbuf *dyn, /* appends the formatted string, returns 0 on success, 1 on error */ int Curl_dyn_vprintf(struct dynbuf *dyn, const char *format, va_list ap_save) { - int retcode; struct asprintf info; info.b = dyn; info.fail = 0; - retcode = dprintf_formatf(&info, alloc_addbyter, format, ap_save); - if(!retcode && info.fail) { + (void)dprintf_formatf(&info, alloc_addbyter, format, ap_save); + if(info.fail) { Curl_dyn_free(info.b); return 1; } -- 2.47.3