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:55:02 +0000 (22:55 +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 f42dd6485affeeee45011235f900bf29365aba43..e29ac2bb97682c0c2c256482efd1bd212f729875 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);