Fix uninitialized variable in Admin::listPolicies() 82/33082/1
authorLukasz Wojciechowski <l.wojciechow@partner.samsung.com>
Fri, 2 Jan 2015 19:32:12 +0000 (20:32 +0100)
committerLukasz Wojciechowski <l.wojciechow@partner.samsung.com>
Fri, 2 Jan 2015 19:32:12 +0000 (20:32 +0100)
struct cynara_admin_policy **policies was uninitialized.
Normally it should be filled with cynara_admin_list_policies() call.
However, when that function failes, it leaves policies unaffected.
If this pointer is not NULL then it is being freed after it is used
to construct vector of policies.

Change-Id: Iff469205035a5240eee64ec87ea724b83577d105

tests/cynara-tests/common/cynara_test_admin.cpp

index f49e887..58823f7 100644 (file)
@@ -266,7 +266,7 @@ void Admin::listPolicies(const char *startBucket,
                          CynaraPoliciesContainer &expectedPolicyList,
                          int expectedResult) {
 
-    struct cynara_admin_policy **policies;
+    struct cynara_admin_policy **policies = nullptr;
 
     int ret = cynara_admin_list_policies(m_admin,
                                          startBucket,