summaryrefslogtreecommitdiffstats
path: root/usr.sbin/apmd
diff options
context:
space:
mode:
authorjedgar <jedgar@FreeBSD.org>2001-01-20 01:22:31 +0000
committerjedgar <jedgar@FreeBSD.org>2001-01-20 01:22:31 +0000
commit4d5acb37f2fef7b99637885736fbcbb0d762da6a (patch)
tree08f20242433055851f6f04a717bd90a05b90f141 /usr.sbin/apmd
parent9cbdff805b63c075131322ca0ce9d2d632663d5a (diff)
downloadFreeBSD-src-4d5acb37f2fef7b99637885736fbcbb0d762da6a.zip
FreeBSD-src-4d5acb37f2fef7b99637885736fbcbb0d762da6a.tar.gz
Check strdup() return values
Reviewed by: kris
Diffstat (limited to 'usr.sbin/apmd')
-rw-r--r--usr.sbin/apmd/apmd.c3
-rw-r--r--usr.sbin/apmd/contrib/pccardq.c15
2 files changed, 14 insertions, 4 deletions
diff --git a/usr.sbin/apmd/apmd.c b/usr.sbin/apmd/apmd.c
index 2ebd5572..470bcc6 100644
--- a/usr.sbin/apmd/apmd.c
+++ b/usr.sbin/apmd/apmd.c
@@ -139,7 +139,8 @@ event_cmd_exec_clone(void *this)
newone->evcmd.len = oldone->evcmd.len;
newone->evcmd.name = oldone->evcmd.name;
newone->evcmd.op = oldone->evcmd.op;
- newone->line = strdup(oldone->line);
+ if ((newone->line = strdup(oldone->line)) == NULL)
+ err(1, "out of memory");
return (struct event_cmd *) newone;
}
void
diff --git a/usr.sbin/apmd/contrib/pccardq.c b/usr.sbin/apmd/contrib/pccardq.c
index 20b789d..2bace22 100644
--- a/usr.sbin/apmd/contrib/pccardq.c
+++ b/usr.sbin/apmd/contrib/pccardq.c
@@ -194,9 +194,18 @@ get_slot_info(int so, int slot, char **manuf, char **version, char
if (s != NULL && strchr(s, '~') != NULL)
goto parse_err;
- *manuf = strdup(_manuf);
- *version = strdup(_version);
- *device = strdup(_device);
+ if ((*manuf = strdup(_manuf)) == NULL) {
+ warn("strdup");
+ goto err;
+ }
+ if ((*version = strdup(_version)) == NULL) {
+ warn("strdup");
+ goto err;
+ }
+ if ((*device = strdup(_device)) == NULL) {
+ warn("strdup");
+ goto err;
+ }
if (*manuf == NULL || *version == NULL || *device == NULL) {
warn("strdup");
goto err;
OpenPOWER on IntegriCloud