]> sourceware.org Git - systemtap.git/commitdiff
coverity fixes: uninitialized class members
authorFrank Ch. Eigler <fche@redhat.com>
Mon, 13 Jul 2015 21:41:41 +0000 (17:41 -0400)
committerFrank Ch. Eigler <fche@redhat.com>
Mon, 13 Jul 2015 21:41:41 +0000 (17:41 -0400)
Pro tip: POD class members need explicit initialization.

dwflpp.h
session.cxx
session.h
tapsets.cxx

index b43642ce0104235fe99896ed877699127da41147..c117cc6171aa0c757dfdbe3c02d51f4b775492d2 100644 (file)
--- a/dwflpp.h
+++ b/dwflpp.h
@@ -181,6 +181,8 @@ struct loc2c_context
 {
   Dwarf_Die *die;
   Dwarf_Addr pc;
+public:
+  loc2c_context(): die(0), pc(0) {}
 };
 
 struct dwflpp
index f55cb332d8bd0310dd3184375656b8d2eaa66273..c9896a2db42575343fb85121343fe22232e47c38 100644 (file)
@@ -96,6 +96,7 @@ systemtap_session::systemtap_session ():
   suppressed_warnings(0),
   suppressed_errors(0),
   warningerr_count(0),
+  target_namespaces_pid(0),
   last_token (0)
 {
   struct utsname buf;
@@ -283,6 +284,7 @@ systemtap_session::systemtap_session (const systemtap_session& other,
   suppressed_warnings(0),
   suppressed_errors(0),
   warningerr_count(0),
+  target_namespaces_pid(0),
   last_token (0)
 {
   release = kernel_release = kern;
index 787b8dc2d1b1227a4ec56c00d3b0977984b3e334..f1291bc5314a2be930e4bb37addf463381a3ed49 100644 (file)
--- a/session.h
+++ b/session.h
@@ -1,5 +1,5 @@
 // -*- C++ -*-
-// Copyright (C) 2005-2014 Red Hat Inc.
+// Copyright (C) 2005-2015 Red Hat Inc.
 //
 // This file is part of systemtap, and is free software.  You can
 // redistribute it and/or modify it under the terms of the GNU General
@@ -339,7 +339,6 @@ public:
   std::vector<vardecl*> unused_globals;
   std::vector<derived_probe*> unused_probes; // see also *_probes groups below
   std::vector<functiondecl*> unused_functions;
-  // XXX: vector<*> instead please?
 
   // resolved/compiled regular expressions for the run
   std::map<std::string, stapdfa*> dfas;
@@ -414,6 +413,8 @@ public:
 
   translator_output* op_create_auxiliary(bool trailer_p = false);
 
+  int target_namespaces_pid;
+
   const token* last_token;
   void print_token (std::ostream& o, const token* tok);
   void print_error (const semantic_error& e);
@@ -445,7 +446,8 @@ public:
   bool is_user_file (const std::string& name);
   bool is_primary_probe (derived_probe *dp);
 
-  int target_namespaces_pid;
+  // NB: It is very important for all of the above (and below) fields
+  // to be cleared in the systemtap_session ctor (session.cxx).
 };
 
 struct exit_exception: public std::runtime_error
index 54f9d3d026577af65ee56ab59fbcf3f81ff7c05a..2a50fbd92279594eb5d254d73e7e3c9b02d38cc5 100644 (file)
@@ -425,7 +425,7 @@ symbol_table
   func_info *get_func_containing_address(Dwarf_Addr addr);
   func_info *get_first_func();
 
-  symbol_table(module_info *mi) : mod_info(mi) {}
+  symbol_table(module_info *mi) : mod_info(mi), opd_section(SHN_UNDEF) {}
   ~symbol_table();
 };
 
This page took 0.051538 seconds and 5 git commands to generate.