+2020-06-16 Mark Wielaard <mark@klomp.org>
+
+ * debuginfod-client.c (debuginfod_query_server): Check malloc.
+ Move curl_multi_init call before handle_data malloc call.
+
2020-06-16 Mark Wielaard <mark@klomp.org>
* debuginfod-client.c (debuginfod_query_server): Replace sizeof
&& (i == 0 || server_urls[i - 1] == url_delim_char))
num_urls++;
+ CURLM *curlm = curl_multi_init();
+ if (curlm == NULL)
+ {
+ rc = -ENETUNREACH;
+ goto out0;
+ }
+
/* Tracks which handle should write to fd. Set to the first
handle that is ready to write the target file to the cache. */
CURL *target_handle = NULL;
struct handle_data *data = malloc(sizeof(struct handle_data) * num_urls);
+ if (data == NULL)
+ {
+ rc = -ENOMEM;
+ goto out0;
+ }
+
+ /* thereafter, goto out1 on error. */
/* Initalize handle_data with default values. */
for (int i = 0; i < num_urls; i++)
data[i].fd = -1;
}
- CURLM *curlm = curl_multi_init();
- if (curlm == NULL)
- {
- rc = -ENETUNREACH;
- goto out0;
- }
- /* thereafter, goto out1 on error. */
-
char *strtok_saveptr;
char *server_url = strtok_r(server_urls, url_delim, &strtok_saveptr);