mirror of
https://github.com/postgres/postgres.git
synced 2025-04-24 10:47:04 +03:00
Fix memory leak for file name if expect file name contains a dot, per
report from dvice_null@yahoo.com.
This commit is contained in:
parent
b813c8daca
commit
9bdf216f9c
@ -11,7 +11,7 @@
|
|||||||
* Portions Copyright (c) 1996-2009, PostgreSQL Global Development Group
|
* Portions Copyright (c) 1996-2009, PostgreSQL Global Development Group
|
||||||
* Portions Copyright (c) 1994, Regents of the University of California
|
* Portions Copyright (c) 1994, Regents of the University of California
|
||||||
*
|
*
|
||||||
* $PostgreSQL: pgsql/src/test/regress/pg_regress.c,v 1.56 2009/01/01 17:24:04 momjian Exp $
|
* $PostgreSQL: pgsql/src/test/regress/pg_regress.c,v 1.57 2009/01/08 20:09:06 momjian Exp $
|
||||||
*
|
*
|
||||||
*-------------------------------------------------------------------------
|
*-------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
@ -1134,7 +1134,11 @@ get_alternative_expectfile(const char *expectfile, int i)
|
|||||||
strcpy(tmp, expectfile);
|
strcpy(tmp, expectfile);
|
||||||
last_dot = strrchr(tmp, '.');
|
last_dot = strrchr(tmp, '.');
|
||||||
if (!last_dot)
|
if (!last_dot)
|
||||||
|
{
|
||||||
|
free(tmp);
|
||||||
|
free(s);
|
||||||
return NULL;
|
return NULL;
|
||||||
|
}
|
||||||
*last_dot = '\0';
|
*last_dot = '\0';
|
||||||
snprintf(s, ssize, "%s_%d.%s", tmp, i, last_dot + 1);
|
snprintf(s, ssize, "%s_%d.%s", tmp, i, last_dot + 1);
|
||||||
free(tmp);
|
free(tmp);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user