From 114d393b53ad56d282c78d573c26e3fa62aa818f Mon Sep 17 00:00:00 2001 From: "Pedro F. Giffuni" Date: Fri, 6 May 2016 01:37:06 +0000 Subject: [PATCH] MFC r298868, r298874: restore: fix memory and resource handle leaks. CID: 272297, 1007784 --- sbin/restore/main.c | 3 ++- sbin/restore/symtab.c | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/sbin/restore/main.c b/sbin/restore/main.c index 91f4a83c7296..d74e59ebeef1 100644 --- a/sbin/restore/main.c +++ b/sbin/restore/main.c @@ -366,7 +366,8 @@ obsolete(int *argcp, char **argvp[]) if (flags) { *p = '\0'; *nargv++ = flagsp; - } + } else + free(flagsp); /* Copy remaining arguments. */ while ((*nargv++ = *argv++)); diff --git a/sbin/restore/symtab.c b/sbin/restore/symtab.c index 9d0313dfb083..17bd64232d3f 100644 --- a/sbin/restore/symtab.c +++ b/sbin/restore/symtab.c @@ -560,6 +560,7 @@ initsymtable(char *filename) fprintf(stderr, "read: %s\n", strerror(errno)); panic("cannot read symbol table file %s\n", filename); } + (void)close(fd); switch (command) { case 'r': /*