Add some free()s in error cases.

This commit is contained in:
wiz 2003-09-23 09:47:20 +00:00
parent 7e60425a84
commit acbbe02c81
3 changed files with 9 additions and 5 deletions

View File

@ -1,11 +1,11 @@
/* $NetBSD: extract.c,v 1.31 2003/09/02 07:34:49 jlam Exp $ */
/* $NetBSD: extract.c,v 1.32 2003/09/23 09:47:20 wiz Exp $ */
#include <sys/cdefs.h>
#ifndef lint
#if 0
static const char *rcsid = "FreeBSD - Id: extract.c,v 1.17 1997/10/08 07:45:35 charnier Exp";
#else
__RCSID("$NetBSD: extract.c,v 1.31 2003/09/02 07:34:49 jlam Exp $");
__RCSID("$NetBSD: extract.c,v 1.32 2003/09/23 09:47:20 wiz Exp $");
#endif
#endif
@ -183,6 +183,8 @@ extract_plist(char *home, package_t *pkg)
"unable to back up %s to %s, aborting pkg_add",
try, pf);
rollback(PkgName, home, pkg->head, p);
free(perm_args);
free(where_args);
return 0;
}
}

View File

@ -1,11 +1,11 @@
/* $NetBSD: exec.c,v 1.9 2002/06/27 12:05:52 yamt Exp $ */
/* $NetBSD: exec.c,v 1.10 2003/09/23 09:47:21 wiz Exp $ */
#include <sys/cdefs.h>
#ifndef lint
#if 0
static const char *rcsid = "from FreeBSD Id: exec.c,v 1.6 1997/10/08 07:47:50 charnier Exp";
#else
__RCSID("$NetBSD: exec.c,v 1.9 2002/06/27 12:05:52 yamt Exp $");
__RCSID("$NetBSD: exec.c,v 1.10 2003/09/23 09:47:21 wiz Exp $");
#endif
#endif
@ -55,6 +55,7 @@ vsystem(const char *fmt,...)
if (vsnprintf(cmd, maxargs, fmt, args) >= maxargs) {
warnx("vsystem args are too long");
va_end(args);
free(cmd);
return 1;
}
#ifdef VSYSTEM_DEBUG

View File

@ -47,7 +47,7 @@
#include "lib.h"
#ifndef lint
__RCSID("$NetBSD: fexec.c,v 1.5 2003/09/23 09:36:06 wiz Exp $");
__RCSID("$NetBSD: fexec.c,v 1.6 2003/09/23 09:47:21 wiz Exp $");
#endif
static int vfcexec(const char *, int, const char *, va_list);
@ -81,6 +81,7 @@ vfcexec(const char *path, int skipempty, const char *arg, va_list ap)
ptr = realloc(argv, new * sizeof(const char *));
if (ptr == NULL) {
warnx("vfcexec can't alloc arg space");
free(argv);
return -1;
}
argv = ptr;