From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from gnu.wildebeest.org (wildebeest.demon.nl [212.238.236.112]) by sourceware.org (Postfix) with ESMTPS id 32DAB3AA9015 for ; Fri, 18 Jun 2021 13:02:54 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 32DAB3AA9015 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 0B89530012EA; Fri, 18 Jun 2021 15:02:52 +0200 (CEST) Received: by tarox.wildebeest.org (Postfix, from userid 1000) id 5E7204016575; Fri, 18 Jun 2021 15:02:52 +0200 (CEST) From: Mark Wielaard To: elfutils-devel@sourceware.org Cc: Mark Wielaard Subject: [PATCH] debuginfod-client: Fix client dereference when calloc fails. Date: Fri, 18 Jun 2021 15:02:43 +0200 Message-Id: <20210618130243.19865-1-mark@klomp.org> X-Mailer: git-send-email 2.18.4 X-Spam-Status: No, score=-9.7 required=5.0 tests=BAYES_00, GIT_PATCH_0, KAM_DMARC_STATUS, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) 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: , X-List-Received-Date: Fri, 18 Jun 2021 13:02:55 -0000 When the calloc call in debuginfod_begin fails we should skip all initialization of the client handle. Signed-off-by: Mark Wielaard --- debuginfod/ChangeLog | 5 +++++ debuginfod/debuginfod-client.c | 10 +++++----- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/debuginfod/ChangeLog b/debuginfod/ChangeLog index 286c910a..d9d11737 100644 --- a/debuginfod/ChangeLog +++ b/debuginfod/ChangeLog @@ -1,3 +1,8 @@ +2021-06-18 Mark Wielaard + + * debuginfod-client.c (debuginfod_begin): Don't use client if + calloc call failed. + 2021-06-03 Frank Ch. Eigler PR27863 diff --git a/debuginfod/debuginfod-client.c b/debuginfod/debuginfod-client.c index ee7eda24..f417b40a 100644 --- a/debuginfod/debuginfod-client.c +++ b/debuginfod/debuginfod-client.c @@ -1193,12 +1193,12 @@ debuginfod_begin (void) client->verbose_fd = STDERR_FILENO; else client->verbose_fd = -1; - } - // allocate 1 curl multi handle - client->server_mhandle = curl_multi_init (); - if (client->server_mhandle == NULL) - goto out1; + // allocate 1 curl multi handle + client->server_mhandle = curl_multi_init (); + if (client->server_mhandle == NULL) + goto out1; + } // extra future initialization -- 2.18.4