summaryrefslogtreecommitdiff
path: root/libexec/ld.so/ldconfig
diff options
context:
space:
mode:
authorOtto Moerbeek <otto@cvs.openbsd.org>2014-07-10 09:03:03 +0000
committerOtto Moerbeek <otto@cvs.openbsd.org>2014-07-10 09:03:03 +0000
commitd5c64fd23befba60623f0fa692b206274bcf5867 (patch)
treeb334e35329c1fc797fe8d85a04d820a11cc41bd3 /libexec/ld.so/ldconfig
parent8e422aee3fc1798232e2f85535bc4752836c2ecc (diff)
check all memory allocations; ok miod@ guenther@
Diffstat (limited to 'libexec/ld.so/ldconfig')
-rw-r--r--libexec/ld.so/ldconfig/sod.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/libexec/ld.so/ldconfig/sod.c b/libexec/ld.so/ldconfig/sod.c
index 90e4fa3efbf..183d02a22be 100644
--- a/libexec/ld.so/ldconfig/sod.c
+++ b/libexec/ld.so/ldconfig/sod.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: sod.c,v 1.4 2014/07/06 11:52:02 miod Exp $ */
+/* $OpenBSD: sod.c,v 1.5 2014/07/10 09:03:02 otto Exp $ */
/*
* Copyright (c) 1993 Paul Kranenburg
@@ -68,6 +68,8 @@ _dl_build_sod(const char *name, struct sod *sodp)
/* default is an absolute or relative path */
sodp->sod_name = (long)strdup(name); /* strtok is destructive */
+ if (sodp->sod_name == 0)
+ exit(7);
sodp->sod_library = 0;
sodp->sod_major = sodp->sod_minor = 0;
@@ -125,6 +127,8 @@ _dl_build_sod(const char *name, struct sod *sodp)
goto backout;
cp = (char *)sodp->sod_name;
sodp->sod_name = (long)strdup(realname);
+ if (sodp->sod_name == 0)
+ exit(7);
free(cp);
sodp->sod_library = 1;
sodp->sod_major = major;
@@ -134,6 +138,8 @@ _dl_build_sod(const char *name, struct sod *sodp)
backout:
free((char *)sodp->sod_name);
sodp->sod_name = (long)strdup(name);
+ if (sodp->sod_name == 0)
+ exit(7);
}
static struct hints_header *hheader = NULL;