OSDN Git Service

Avoid use of uninitialized variables
authorKyotaro Horiguchi <horikyota.ntt@gmail.com>
Tue, 30 Nov 2021 06:38:45 +0000 (15:38 +0900)
committerKyotaro Horiguchi <horikyota.ntt@gmail.com>
Mon, 17 Jan 2022 02:47:36 +0000 (11:47 +0900)
Some variables may be used uninitialized. Fix that.

pg_store_plans.c

index cfc2578..343f317 100644 (file)
@@ -578,7 +578,7 @@ pgsp_shmem_startup(void)
 {
        bool            found;
        HASHCTL         info;
-       FILE       *file;
+       FILE       *file = NULL;
        FILE       *pfile = NULL;
        uint32          header;
        int32           num;
@@ -1512,6 +1512,7 @@ pg_store_plans_internal(FunctionCallInfo fcinfo,
                                        mstr = pgsp_json_xmlize(pstr);
                                        break;
                                default:
+                                       mstr = pstr;
                                        break;
                        }
 
@@ -1746,6 +1747,9 @@ entry_dealloc(void)
        entries = palloc(hash_get_num_entries(hash_table) * sizeof(pgspEntry *));
 
        i = 0;
+       tottextlen = 0;
+       nvalidtexts = 0;
+
        hash_seq_init(&hash_seq, hash_table);
        while ((entry = hash_seq_search(&hash_seq)) != NULL)
        {