summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMark Wielaard <mark@klomp.org>2022-11-15 17:50:01 +0100
committerMark Wielaard <mark@klomp.org>2022-11-21 18:20:59 +0100
commit274f2376c458ba62534740d1a29e841e930aeda7 (patch)
treec5be7b1d401842d1b1d8fe7e16ba8f02df3b9463
parent88bab837c1d96a1f9a589dca74101ff378a0ff65 (diff)
downloadelfutils-274f2376c458ba62534740d1a29e841e930aeda7.tar.gz
debuginfod: Initialize response_data early in debuginfod-client query
On error going to out2, the response_data is freed. So initialize the response_data to NULL immediately after allocation or when going back to query_in_parallel. Signed-off-by: Mark Wielaard <mark@klomp.org>
-rw-r--r--debuginfod/ChangeLog5
-rw-r--r--debuginfod/debuginfod-client.c4
2 files changed, 7 insertions, 2 deletions
diff --git a/debuginfod/ChangeLog b/debuginfod/ChangeLog
index a17bc5ab..a7afed94 100644
--- a/debuginfod/ChangeLog
+++ b/debuginfod/ChangeLog
@@ -1,3 +1,8 @@
+2022-11-15 Mark Wielaard <mark@klomp.org>
+
+ * debuginfod-client.c (debuginfod_query_server): Initialize
+ response_data early.
+
2022-11-07 Aaron Merey <amerey@redhat.com>
* debuginfod-client.c (debuginfod_find_section): Don't treat 0 as an
diff --git a/debuginfod/debuginfod-client.c b/debuginfod/debuginfod-client.c
index f9f26fd5..8873fcc8 100644
--- a/debuginfod/debuginfod-client.c
+++ b/debuginfod/debuginfod-client.c
@@ -1250,6 +1250,8 @@ debuginfod_query_server (debuginfod_client *c,
data[i].handle = NULL;
data[i].fd = -1;
data[i].errbuf[0] = '\0';
+ data[i].response_data = NULL;
+ data[i].response_data_size = 0;
}
char *escaped_string = NULL;
@@ -1346,8 +1348,6 @@ debuginfod_query_server (debuginfod_client *c,
curl_easy_setopt_ck (data[i].handle, CURLOPT_LOW_SPEED_LIMIT,
100 * 1024L);
}
- data[i].response_data = NULL;
- data[i].response_data_size = 0;
curl_easy_setopt_ck(data[i].handle, CURLOPT_FILETIME, (long) 1);
curl_easy_setopt_ck(data[i].handle, CURLOPT_FOLLOWLOCATION, (long) 1);
curl_easy_setopt_ck(data[i].handle, CURLOPT_FAILONERROR, (long) 1);