libt2n: (tomj) fix uninitialized variable "result_type" in result_container
authorThomas Jarosch <thomas.jarosch@intra2net.com>
Tue, 25 Nov 2008 14:58:48 +0000 (14:58 +0000)
committerThomas Jarosch <thomas.jarosch@intra2net.com>
Tue, 25 Nov 2008 14:58:48 +0000 (14:58 +0000)
src/container.cpp
src/container.hxx

index 47d0e49..0401af8 100644 (file)
@@ -40,6 +40,9 @@ result_container::~result_container()
         delete res;
     if (ex)
         delete ex;
+
+    res = NULL;
+    ex = NULL;
 }
 
 /** @brief returns the result or throw the carried exception.
@@ -49,6 +52,7 @@ result* result_container::get_result(void)
 {
     if (result_type==exception)
         ex->do_throw();
+
     return res;
 }
 
@@ -57,6 +61,8 @@ command_container::~command_container()
 {
     if (cmd)
         delete cmd;
+
+    cmd = NULL;
 }
 
 } // namespace libt2n
index 478c464..020194b 100644 (file)
@@ -49,17 +49,31 @@ class result_container
 
     public:
         result_container()
-            { res=0; ex=0; }
+            : res(NULL)
+            , ex(NULL)
+            , result_type(regular)
+        {
+        }
 
         result_container(result *_res)
-            { set_result(_res); }
+            : res(_res)
+            , ex(NULL)
+            , result_type(regular)
+        {
+        }
+
         result_container(t2n_exception *_ex)
-            { set_exception(_ex); }
+            : res(NULL)
+            , ex(_ex)
+            , result_type(exception)
+        {
+        }
 
         ~result_container();
 
         void set_result(result *_res)
             { res=_res; ex=0; result_type=regular; }
+
         void set_exception(t2n_exception *_ex)
             { res=0; ex=_ex; result_type=exception; }
 
@@ -84,9 +98,12 @@ class command_container
 
     public:
         command_container()
-            { cmd=0; }
+            : cmd(NULL)
+        {}
+
         command_container(command *_cmd)
-            { cmd=_cmd; }
+            : cmd(_cmd)
+        {}
 
         ~command_container();