Fix memory leak when do_query() fails.
authorTatsuo Ishii <ishii@postgresql.org>
Sat, 26 Oct 2013 09:09:39 +0000 (18:09 +0900)
committerTatsuo Ishii <ishii@postgresql.org>
Sat, 26 Oct 2013 09:09:39 +0000 (18:09 +0900)
Per Coverity report "1111444 Resource leak".

src/streaming_replication/pool_worker_child.c

index 831a6b9409450b5a4d4c87b1bfb8886a9582f322..093c8cc2e0f6cb02d2a620c24a696cc9fbc0c689 100644 (file)
@@ -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;
                }