pgpool2.git / summary / log / commit / refs

commit    c7bb34b61a0f8ba02c8e24e3dc86cf56e15027d4
Author:   Tatsuo Ishii <ishii@postgresql.org>
Date:     Fri May 23 20:40:35 2014 +0000

    Fix memory leak.
    
    Per Coverity 1111442.


src/libs/pcp/pcp.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/libs/pcp/pcp.c b/src/libs/pcp/pcp.c index ba4445a52..b4d8b4203 100644 --- a/src/libs/pcp/pcp.c +++ b/src/libs/pcp/pcp.c @@ -774,11 +774,22 @@ pcp_systemdb_info(void) } if (debug) fprintf(stderr, "DEBUG: send: tos=\"S\", len=%d\n", ntohl(wsize)); - while (1) { + while (1) + { if (pcp_read(pc, &tos, 1)) + { + if (buf != NULL) + pfree(buf); return NULL; + } + if (pcp_read(pc, &rsize, sizeof(int))) + { + if (buf != NULL) + pfree(buf); return NULL; + } + rsize = ntohl(rsize); buf = (char *)palloc(rsize); if (buf == NULL) [parent: befe0dd3647e]