]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
mprintf: fix *dyn_vprintf() when out-of-memory
authorDaniel Stenberg <daniel@haxx.se>
Tue, 19 Jul 2022 20:32:12 +0000 (22:32 +0200)
committerDaniel Stenberg <daniel@haxx.se>
Tue, 19 Jul 2022 21:56:03 +0000 (23:56 +0200)
Follow-up to 0e48ac1f99a. Torture-testing 1455 would lead to a memory
leak otherwise.

Closes #9185

lib/mprintf.c

index 1d8052dcd65b7aad6b68a9aec09c0e3c0f9fd81b..30347de250f3e6710b599f5e30897a2b20c55565 100644 (file)
@@ -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;
   }