diff options
author | joerg <joerg> | 2008-08-02 20:33:50 +0000 |
---|---|---|
committer | joerg <joerg> | 2008-08-02 20:33:50 +0000 |
commit | 7be93b44a0d2e33aa0dd07de5f5b673bf95b27c8 (patch) | |
tree | 8901b5966bac844405a560018181d94cc4eccd35 /pkgtools/pkg_install/files/info/main.c | |
parent | f3a58140319f67643ea733850de213b695037b07 (diff) | |
download | pkgsrc-7be93b44a0d2e33aa0dd07de5f5b673bf95b27c8.tar.gz |
Most memory allocation failures were fatal already and the majority of
the rest lacked an explicit check. Add the usual x* wrappers around
malloc and friends that explicitly terminate on error and use them in
all but Dewey.
Diffstat (limited to 'pkgtools/pkg_install/files/info/main.c')
-rw-r--r-- | pkgtools/pkg_install/files/info/main.c | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/pkgtools/pkg_install/files/info/main.c b/pkgtools/pkg_install/files/info/main.c index b6a17261a13..b5d75ce8bf1 100644 --- a/pkgtools/pkg_install/files/info/main.c +++ b/pkgtools/pkg_install/files/info/main.c @@ -1,4 +1,4 @@ -/* $NetBSD: main.c,v 1.22 2007/11/05 09:39:38 joerg Exp $ */ +/* $NetBSD: main.c,v 1.22.6.1 2008/08/02 20:33:50 joerg Exp $ */ #if HAVE_CONFIG_H #include "config.h" @@ -11,7 +11,7 @@ #if 0 static char *rcsid = "from FreeBSD Id: main.c,v 1.14 1997/10/08 07:47:26 charnier Exp"; #else -__RCSID("$NetBSD: main.c,v 1.22 2007/11/05 09:39:38 joerg Exp $"); +__RCSID("$NetBSD: main.c,v 1.22.6.1 2008/08/02 20:33:50 joerg Exp $"); #endif #endif @@ -271,11 +271,9 @@ main(int argc, char **argv) s = pkgdb_retrieve(CheckPkg); - if (s) { - CheckPkg = strdup(s); - } else { + if (s == NULL) errx(EXIT_FAILURE, "No matching pkg for %s.", CheckPkg); - } + CheckPkg = xstrdup(s); pkgdb_close(); } |