Skip to content

Commit 4e23d6e

Browse files
author
Michael Meskes
committed
Fixed a few trivial memory leaks reported by Coverity just to test my setup.
1 parent fc19744 commit 4e23d6e

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/bin/initdb/initdb.c

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@
4242
* Portions Copyright (c) 1994, Regents of the University of California
4343
* Portions taken from FreeBSD.
4444
*
45-
* $PostgreSQL: pgsql/src/bin/initdb/initdb.c,v 1.120 2006/07/31 01:16:37 tgl Exp $
45+
* $PostgreSQL: pgsql/src/bin/initdb/initdb.c,v 1.121 2006/08/20 16:08:09 meskes Exp $
4646
*
4747
*-------------------------------------------------------------------------
4848
*/
@@ -419,6 +419,7 @@ readfile(char *path)
419419
}
420420

421421
fclose(infile);
422+
free(buffer);
422423
result[nlines] = NULL;
423424

424425
return result;
@@ -1058,6 +1059,7 @@ set_short_version(char *short_version, char *extrapath)
10581059
progname, path, strerror(errno));
10591060
exit_nicely();
10601061
}
1062+
free(path);
10611063
}
10621064

10631065
/*
@@ -1085,6 +1087,7 @@ set_null_conf(void)
10851087
progname, path, strerror(errno));
10861088
exit_nicely();
10871089
}
1090+
free(path);
10881091
}
10891092

10901093
/*
@@ -1543,6 +1546,9 @@ get_set_pwd(void)
15431546
PG_CMD_PRINTF2("ALTER USER \"%s\" WITH PASSWORD E'%s';\n",
15441547
username, escape_quotes(pwd1));
15451548

1549+
/* MM: pwd1 is no longer needed, freeing it */
1550+
free(pwd1);
1551+
15461552
PG_CMD_CLOSE;
15471553

15481554
check_ok();

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy