diff options
author | Daniel Stenberg <daniel@haxx.se> | 2022-07-19 22:32:12 +0200 |
---|---|---|
committer | Daniel Stenberg <daniel@haxx.se> | 2022-07-19 23:56:03 +0200 |
commit | 7935972b37a30ac5937c3e253dbb7b7ae7f38ee3 (patch) | |
tree | 1f2791f5dbbcfc59a5ffd8b2834fb9aff46e18cc /lib/mprintf.c | |
parent | 24694cb3eab00418707f8bb4cc52b937dece51c7 (diff) | |
download | curl-7935972b37a30ac5937c3e253dbb7b7ae7f38ee3.tar.gz |
mprintf: fix *dyn_vprintf() when out-of-memory
Follow-up to 0e48ac1f99a. Torture-testing 1455 would lead to a memory
leak otherwise.
Closes #9185
Diffstat (limited to 'lib/mprintf.c')
-rw-r--r-- | lib/mprintf.c | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/lib/mprintf.c b/lib/mprintf.c index 1d8052dcd..30347de25 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; } |