From patchwork Tue Nov 15 16:55:40 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Wielaard X-Patchwork-Id: 60655 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id E2EDF389EC4C for ; Tue, 15 Nov 2022 16:55:53 +0000 (GMT) X-Original-To: elfutils-devel@sourceware.org Delivered-To: elfutils-devel@sourceware.org Received: from gnu.wildebeest.org (gnu.wildebeest.org [45.83.234.184]) by sourceware.org (Postfix) with ESMTPS id E4BC8389EC4C for ; Tue, 15 Nov 2022 16:55:46 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org E4BC8389EC4C Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=klomp.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=klomp.org Received: from tarox.wildebeest.org (83-87-18-245.cable.dynamic.v4.ziggo.nl [83.87.18.245]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by gnu.wildebeest.org (Postfix) with ESMTPSA id A18F53032FBF; Tue, 15 Nov 2022 17:55:45 +0100 (CET) Received: by tarox.wildebeest.org (Postfix, from userid 1000) id 5E4F5413CBBB; Tue, 15 Nov 2022 17:55:45 +0100 (CET) From: Mark Wielaard To: elfutils-devel@sourceware.org Cc: Mark Wielaard Subject: [PATCH] debuginfod: Initialize response_data early in debuginfod-client query Date: Tue, 15 Nov 2022 17:55:40 +0100 Message-Id: <20221115165540.26020-1-mark@klomp.org> X-Mailer: git-send-email 2.18.4 X-Spam-Status: No, score=-3039.0 required=5.0 tests=BAYES_00, GIT_PATCH_0, JMQ_SPF_NEUTRAL, KAM_DMARC_STATUS, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: elfutils-devel@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Elfutils-devel mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , Errors-To: elfutils-devel-bounces+patchwork=sourceware.org@sourceware.org Sender: "Elfutils-devel" 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 --- debuginfod/ChangeLog | 5 +++++ debuginfod/debuginfod-client.c | 4 ++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/debuginfod/ChangeLog b/debuginfod/ChangeLog index 5678002a..2a9ba518 100644 --- a/debuginfod/ChangeLog +++ b/debuginfod/ChangeLog @@ -1,3 +1,8 @@ +2022-11-15 Mark Wielaard + + * debuginfod-client.c (debuginfod_query_server): Initialize + response_data early. + 2022-11-04 Aaron Merey * debuginfod-client.c (debuginfod_find_section): Ensure rc diff --git a/debuginfod/debuginfod-client.c b/debuginfod/debuginfod-client.c index 99da05ef..c92ef274 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);