public inbox for elfutils@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] debuginfod-client: Fix client dereference when calloc fails.
@ 2021-06-18 13:02 Mark Wielaard
  2021-07-02 22:35 ` Mark Wielaard
  0 siblings, 1 reply; 2+ messages in thread
From: Mark Wielaard @ 2021-06-18 13:02 UTC (permalink / raw)
  To: elfutils-devel; +Cc: Mark Wielaard

When the calloc call in debuginfod_begin fails we should skip all
initialization of the client handle.

Signed-off-by: Mark Wielaard <mark@klomp.org>
---
 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  <mark@klomp.org>
+
+	* debuginfod-client.c (debuginfod_begin): Don't use client if
+	calloc call failed.
+
 2021-06-03  Frank Ch. Eigler <fche@redhat.com>
 
 	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


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] debuginfod-client: Fix client dereference when calloc fails.
  2021-06-18 13:02 [PATCH] debuginfod-client: Fix client dereference when calloc fails Mark Wielaard
@ 2021-07-02 22:35 ` Mark Wielaard
  0 siblings, 0 replies; 2+ messages in thread
From: Mark Wielaard @ 2021-07-02 22:35 UTC (permalink / raw)
  To: elfutils-devel

On Fri, Jun 18, 2021 at 03:02:43PM +0200, Mark Wielaard wrote:
> When the calloc call in debuginfod_begin fails we should skip all
> initialization of the client handle.

Pushed.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-07-02 22:35 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-18 13:02 [PATCH] debuginfod-client: Fix client dereference when calloc fails Mark Wielaard
2021-07-02 22:35 ` Mark Wielaard

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).