mirror of
https://github.com/curl/curl.git
synced 2025-03-13 15:37:04 +08:00
mprintf: fix *dyn_vprintf() when out-of-memory
Follow-up to 0e48ac1f99a. Torture-testing 1455 would lead to a memory leak otherwise. Closes #9185
This commit is contained in:
parent
24694cb3ea
commit
7935972b37
@ -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;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user