The following bug has been logged online:
Bug reference: 4494
Logged by:
Email address: dvice_null@yahoo.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;
}