Fix coverity issue:1223003 Uninitialized scalar variable.
authorMuhammad Usama <m.usama@gmail.com>
Fri, 11 Jul 2014 09:58:29 +0000 (14:58 +0500)
committerMuhammad Usama <m.usama@gmail.com>
Fri, 11 Jul 2014 09:58:29 +0000 (14:58 +0500)
Fix coverity issue:1223002 Uninitialized scalar variable.
Fix coverity issue:1223001 Resource leak.
Fix coverity issue:1223000 Resource leak.

pool_proto2.c
pool_proto_modules.c

index 4cd1d76bac8fdec38a8c6deb24cda652eec209bc..835978686e13d2619516e20add1869572591508b 100644 (file)
@@ -378,7 +378,7 @@ POOL_STATUS ErrorResponse(POOL_CONNECTION *frontend,
                                                  POOL_CONNECTION_POOL *backend)
 {
        char *string = NULL;
-       int len;
+       int len = 0;
        int i;
        POOL_STATUS ret = POOL_CONTINUE;
 
@@ -484,7 +484,7 @@ POOL_STATUS NoticeResponse(POOL_CONNECTION *frontend,
                                                   POOL_CONNECTION_POOL *backend)
 {
        char *string = NULL;
-       int len;
+       int len = 0;
        int i;
 
        for (i=0;i<NUM_BACKENDS;i++)
@@ -532,6 +532,8 @@ POOL_STATUS NotificationResponse(POOL_CONNECTION *frontend,
                        {
                                pid1 = pid;
                                len1 = len;
+                   if(condition1)
+                    free(condition1);
                                condition1 = strdup(condition);
                        }
                }
index ae39aae8d857298ebf924f0625f09286fe1fac5d..dd31b263ce6213471d8b7d6faf145e97f6621131 100644 (file)
@@ -1949,6 +1949,7 @@ POOL_STATUS ParameterDescription(POOL_CONNECTION *frontend,
                        if (status < 0)
                        {
                                pool_error("ParameterDescription: error while reading message length");
+                free(p1);
                                return POOL_END;
                        }
 
@@ -1957,8 +1958,10 @@ POOL_STATUS ParameterDescription(POOL_CONNECTION *frontend,
 
                        p = pool_read2(CONNECTION(backend, i), len);
                        if (p == NULL)
+            {
+                free(p1);
                                return POOL_END;
-
+            }
                        if (len != len1)
                        {
                                pool_debug("ParameterDescription: length does not match between backends master(%d) %d th backend(%d) kind:(%c)",
@@ -1985,7 +1988,6 @@ POOL_STATUS ParameterDescription(POOL_CONNECTION *frontend,
        }
 
        free(p1);
-
        return POOL_CONTINUE;
 }