debuginfod-client: Fix client dereference when calloc fails.
authorMark Wielaard <mark@klomp.org>
Fri, 18 Jun 2021 13:02:43 +0000 (15:02 +0200)
committerMark Wielaard <mark@klomp.org>
Fri, 2 Jul 2021 22:25:07 +0000 (00:25 +0200)
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
debuginfod/debuginfod-client.c

index 286c910..d9d1173 100644 (file)
@@ -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
index ee7eda2..f417b40 100644 (file)
@@ -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