From 162c7069ccdcffa444d0fd2b398af3f77cd59607 Mon Sep 17 00:00:00 2001 From: Tatsuo Ishii Date: Sat, 26 Oct 2013 18:09:39 +0900 Subject: [PATCH] Fix memory leak when do_query() fails. Per Coverity report "1111444 Resource leak". --- src/streaming_replication/pool_worker_child.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/streaming_replication/pool_worker_child.c b/src/streaming_replication/pool_worker_child.c index 831a6b940..093c8cc2e 100644 --- a/src/streaming_replication/pool_worker_child.c +++ b/src/streaming_replication/pool_worker_child.c @@ -5,7 +5,7 @@ * pgpool: a language independent connection pool server for PostgreSQL * written by Tatsuo Ishii * - * Copyright (c) 2003-2012 PgPool Global Development Group + * Copyright (c) 2003-2013 PgPool Global Development Group * * Permission to use, copy, modify, and distribute this software and * its documentation for any purpose and without fee is hereby @@ -249,6 +249,8 @@ static void check_replication_time_lag(void) sts = do_query(slots[i]->con, query, &res, PROTO_MAJOR_V3); if (sts != POOL_CONTINUE) { + if (res) + free_select_result(res); pool_error("check_replication_time_lag: %s failed", query); return; } -- 2.39.5