Re: BUG #4494: Memory leak in pg_regress.c

From: Bruce Momjian <bruce(at)momjian(dot)us>
To: dvice_null(at)yahoo(dot)com
Cc: pgsql-bugs(at)postgresql(dot)org, dvice_null(at)yahoo(dot)com
Subject: Re: BUG #4494: Memory leak in pg_regress.c
Date: 2009-01-08 20:09:54
Message-ID: 200901082009.n08K9sQ13969@momjian.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs


Patch written, attached, and applied.

---------------------------------------------------------------------------

dvice_null(at)yahoo(dot)com wrote:
>
> The following bug has been logged online:
>
> Bug reference: 4494
> Logged by:
> Email address: dvice_null(at)yahoo(dot)com
> PostgreSQL version: Latest cvs
> Operating system: Error in source code
> Description: Memory leak in pg_regress.c
> Details:
>
> In file src/test/regress/pg_regress.c:1112
>
> It seems to me that variables "s" and "tmp" leak memory here if last_dot is
> false:
>
>
> static char *
> get_alternative_expectfile(const char *expectfile, int i)
> {
> char *last_dot;
> int ssize = strlen(expectfile) + 2 + 1;
> char *tmp = (char *) malloc(ssize);
> char *s = (char *) malloc(ssize);
>
> strcpy(tmp, expectfile);
> last_dot = strrchr(tmp, '.');
> if (!last_dot)
> return NULL;
> *last_dot = '\0';
> snprintf(s, ssize, "%s_%d.%s", tmp, i, last_dot + 1);
> free(tmp);
> return s;
> }
>
> --
> Sent via pgsql-bugs mailing list (pgsql-bugs(at)postgresql(dot)org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-bugs

--
Bruce Momjian <bruce(at)momjian(dot)us> http://momjian.us
EnterpriseDB http://enterprisedb.com

+ If your life is a hard drive, Christ can be your backup. +

Attachment Content-Type Size
/rtmp/diff text/x-diff 623 bytes

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Simon Riggs 2009-01-08 20:23:44 Re: PANIC: failed to re-find parent key in "100924" for split pages 1606/1673
Previous Message Tom Lane 2009-01-08 20:04:45 Re: PANIC: failed to re-find parent key in "100924" for split pages 1606/1673