Commit Message
Hi -
Showing diff -w to omit reindentation whitespace noise. Maybe worth
backporting to 0.188 releases, could affect federation intermediate
servers with burst workload.
commit ec166cf3c8d825a2f02aca448a0823de12e78991 (HEAD -> master)
Author: Frank Ch. Eigler <fche@redhat.com>
Date: Thu Nov 3 10:07:31 2022 -0400
debuginfod.cxx: fix coverity-found use-after-release error
The debuginfod_client object lifetime needs more careful handling,
made easier with the defer_dtor<> gadget.
Signed-off-by: Frank Ch. Eigler <fche@redhat.com>
@@ -1,3 +1,8 @@
+2022-11-03 Frank Ch. Eigler <fche@redhat.com>
+
+ * debuginfod.cxx (handle_buildid): Correctly manage lifetime
+ of debuginfod_client federation callout object.
+
2022-11-02 Mark Wielaard <mark@klomp.org>
* debuginfod-client.c (extract_section): Mark static.
@@ -2249,8 +2249,10 @@ handle_buildid (MHD_Connection* conn,
int fd = -1;
debuginfod_client *client = debuginfod_pool_begin ();
- if (client != NULL)
- {
+ if (client == NULL)
+ throw libc_exception(errno, "debuginfod client pool alloc");
+ defer_dtor<debuginfod_client*,void> client_closer (client, debuginfod_pool_end);
+
debuginfod_set_progressfn (client, & debuginfod_find_progress);
if (conn)
@@ -2323,11 +2325,6 @@ and will not query the upstream servers");
(const unsigned char*) buildid.c_str(),
0, section.c_str(), NULL);
- }
- else
- fd = -errno; /* Set by debuginfod_begin. */
- debuginfod_pool_end (client);
-
if (fd >= 0)
{
if (conn != 0)