2021-12-01 Mark Wielaard <mark@klomp.org>
+ * debuginfod-client.c (debuginfod_query_server): Free tmp_url on
+ realloc error. curl_free escaped_string on error. Fix error out
+ goto on curl_easy_init failure. Only cleanup data[i] handle and
+ response_data if it was initialized.
+
+2021-12-01 Mark Wielaard <mark@klomp.org>
+
* debuginfod-client.c (timestamp): Use gmtime_r instead of gmtime.
(add_mhd_last_modified): Likewise.
/* Retrieve ELF / DWARF / source files from the debuginfod.
Copyright (C) 2019-2021 Red Hat, Inc.
+ Copyright (C) 2021 Mark J. Wielaard <mark@klomp.org>
This file is part of elfutils.
This file is free software; you can redistribute it and/or modify
sizeof(char*));
if (realloc_ptr == NULL)
{
+ free (tmp_url);
rc = -ENOMEM;
goto out1;
}
goto out1;
}
- /* thereafter, goto out1 on error. */
+ /* thereafter, goto out2 on error. */
/*The beginning of goto block query_in_parallel.*/
query_in_parallel:
data[i].handle = curl_easy_init();
if (data[i].handle == NULL)
{
+ if (filename) curl_free (escaped_string);
rc = -ENETUNREACH;
- goto out1;
+ goto out2;
}
data[i].client = c;
/* remove all handles from multi */
for (int i = 0; i < num_urls; i++)
{
- curl_multi_remove_handle(curlm, data[i].handle); /* ok to repeat */
- curl_easy_cleanup (data[i].handle);
- free (data[i].response_data);
+ if (data[i].handle != NULL)
+ {
+ curl_multi_remove_handle(curlm, data[i].handle); /* ok to repeat */
+ curl_easy_cleanup (data[i].handle);
+ free (data[i].response_data);
+ }
}
unlink (target_cache_tmppath);