Fix memory leak found by Coverity,
authorTatsuo Ishii <ishii@sraoss.co.jp>
Thu, 15 Nov 2018 00:21:30 +0000 (09:21 +0900)
committerTatsuo Ishii <ishii@sraoss.co.jp>
Thu, 15 Nov 2018 00:26:56 +0000 (09:26 +0900)
This is actually harmless since in the situation pgpool child process
exits and the leaked memory is gone anyway.  I just want to shut off
Coverity's complain.

src/protocol/child.c

index d8e4e87b765c40fbc0bcbb93cfc689314e58120a..7f51232096e15d1979955c88c52105abeef3332b 100644 (file)
@@ -2169,7 +2169,7 @@ static void validate_backend_connectivity(int front_end_fd)
                if(front_end_fd > 0)
                {
                        POOL_CONNECTION *cp;
-                       StartupPacket *sp;
+                       volatile StartupPacket *sp;
 
                        /* 
              * we do not want to report socket error, as above errors
@@ -2199,6 +2199,7 @@ static void validate_backend_connectivity(int front_end_fd)
                 FlushErrorState();
                                ereport(FATAL,
                                        (errmsg("%s",error_msg),errdetail("%s",error_detail),errhint("%s",error_hint)));
+                               pfree(sp);
                        }
                        PG_END_TRY();
                }