From 848f747377cd84f6d1fd4cd6b33e75c0a9b1eaa5 Mon Sep 17 00:00:00 2001 From: "Frank Ch. Eigler" Date: Thu, 19 Oct 2017 22:22:57 -0400 Subject: [PATCH] coverity fixes One pthread_create() RC check, one extra-initialized variable. --- loc2stap.cxx | 2 +- stap-serverd.cxx | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/loc2stap.cxx b/loc2stap.cxx index 6fd7807fe..a79fcd356 100644 --- a/loc2stap.cxx +++ b/loc2stap.cxx @@ -796,7 +796,7 @@ location_context::frame_location() // the DW_AT_frame_base attribute expression's value first. const Dwarf_Op *fb_ops; Dwarf_Op *fb_expr; - size_t fb_len; + size_t fb_len = 0; if (this->fb_attr == NULL) { diff --git a/stap-serverd.cxx b/stap-serverd.cxx index 7cf76c617..b8f70114c 100644 --- a/stap-serverd.cxx +++ b/stap-serverd.cxx @@ -2431,10 +2431,12 @@ accept_connections (PRFileDesc *listenSocket, CERTCertificate *cert) t_arg->addr = addr; /* Handle the conncection */ + int thread_rc = -1; if (max_threads > 0) /* Create the worker thread and handle the connection. */ - pthread_create(&tid, NULL, handle_connection, t_arg); - else + thread_rc = pthread_create(&tid, NULL, handle_connection, t_arg); + + if (thread_rc != 0) /* Since max_threads == 0, don't spawn a new thread, * just handle in the current thread. */ handle_connection(t_arg); -- 2.43.5