summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChad Loder <cloder@cvs.openbsd.org>2005-03-06 17:40:02 +0000
committerChad Loder <cloder@cvs.openbsd.org>2005-03-06 17:40:02 +0000
commitca590bb37e9f6789eb7359168f75030afa46af0b (patch)
tree91be690ef6093d6a839528af4cf8296daf54ce5c
parente3c1279904f73552b5e47d5756866bc959b09c3a (diff)
Check strdup return value for failure. OK miod
-rw-r--r--sbin/pdisk/pdisk.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/sbin/pdisk/pdisk.c b/sbin/pdisk/pdisk.c
index cb371e05bdc..c36365532fc 100644
--- a/sbin/pdisk/pdisk.c
+++ b/sbin/pdisk/pdisk.c
@@ -1042,7 +1042,10 @@ do_display_block(partition_map_header *map, char *alt_name)
return;
}
} else {
- name = strdup(alt_name);
+ if ((name = strdup(alt_name)) == NULL) {
+ error(errno, "strdup failed");
+ return;
+ }
}
m = open_pathname_as_media(name, O_RDONLY);
if (m == 0) {