Check strdup() return values
Reviewed by: kris
This commit is contained in:
parent
2ceeaae1ed
commit
ff858da87b
@ -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
|
||||
|
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user