diff options
author | delphij <delphij@FreeBSD.org> | 2010-02-03 23:56:12 +0000 |
---|---|---|
committer | delphij <delphij@FreeBSD.org> | 2010-02-03 23:56:12 +0000 |
commit | 934832db48958bd34fd0b58dfe676a5788151273 (patch) | |
tree | 86d369cb9dfcd9cbd07c95e89f2a68df295c264a /sbin | |
parent | defb20d9cd9bcba963d74c62cbf87a6ac6f0cbb2 (diff) | |
download | FreeBSD-src-934832db48958bd34fd0b58dfe676a5788151273.zip FreeBSD-src-934832db48958bd34fd0b58dfe676a5788151273.tar.gz |
Plug two memory leaks in error case.
MFC after: 1 month
Diffstat (limited to 'sbin')
-rw-r--r-- | sbin/dump/itime.c | 4 | ||||
-rw-r--r-- | sbin/dump/main.c | 3 |
2 files changed, 5 insertions, 2 deletions
diff --git a/sbin/dump/itime.c b/sbin/dump/itime.c index 1f1a3e5..4cac87b 100644 --- a/sbin/dump/itime.c +++ b/sbin/dump/itime.c @@ -106,8 +106,10 @@ readdumptimes(FILE *df) for (;;) { dtwalk = (struct dumptime *)calloc(1, sizeof (struct dumptime)); - if (getrecord(df, &(dtwalk->dt_value)) < 0) + if (getrecord(df, &(dtwalk->dt_value)) < 0) { + free(dtwalk); break; + } nddates++; SLIST_INSERT_HEAD(&dthead, dtwalk, dt_list); } diff --git a/sbin/dump/main.c b/sbin/dump/main.c index 7a99522..e344887 100644 --- a/sbin/dump/main.c +++ b/sbin/dump/main.c @@ -767,7 +767,8 @@ obsolete(int *argcp, char **argvp[]) if (flags) { *p = '\0'; *nargv++ = flagsp; - } + } else + free(flagsp); /* Copy remaining arguments. */ while ((*nargv++ = *argv++)); |