Fix resource leaks in pool_memqcache.c.
authorTatsuo Ishii <ishii@postgresql.org>
Sat, 14 Sep 2024 13:52:49 +0000 (22:52 +0900)
committerTatsuo Ishii <ishii@postgresql.org>
Sat, 14 Sep 2024 13:52:49 +0000 (22:52 +0900)
These leaks were brought in by commit 6fdba5c33 " Use psprintf()
instead of snprintf()."  Since the commit was backpatched through 4.1,
this needs to be backpatched through 4.1 too.

Per Coverity (CID 1559726).
Backpatch-through: 4.1.

src/query_cache/pool_memqcache.c

index 58e5e971441c77c95ab7440c8d94d2f0f1b6d669..ad1501c0c417644ce97f5b977815545c6b4c938c 100644 (file)
@@ -1743,6 +1743,7 @@ pool_add_table_oid_map(POOL_CACHEKEY * cachekey, int num_table_oids, int *table_
                                        (errmsg("memcache: adding table oid maps, failed to write file:\"%s\"", path),
                                         errdetail("%m")));
                        close(fd);
+                       pfree(path);
                        return;
                }
                close(fd);