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

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

Reply via email to