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.len = oldone->evcmd.len;
|
||||||
newone->evcmd.name = oldone->evcmd.name;
|
newone->evcmd.name = oldone->evcmd.name;
|
||||||
newone->evcmd.op = oldone->evcmd.op;
|
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;
|
return (struct event_cmd *) newone;
|
||||||
}
|
}
|
||||||
void
|
void
|
||||||
|
@ -194,9 +194,18 @@ get_slot_info(int so, int slot, char **manuf, char **version, char
|
|||||||
if (s != NULL && strchr(s, '~') != NULL)
|
if (s != NULL && strchr(s, '~') != NULL)
|
||||||
goto parse_err;
|
goto parse_err;
|
||||||
|
|
||||||
*manuf = strdup(_manuf);
|
if ((*manuf = strdup(_manuf)) == NULL) {
|
||||||
*version = strdup(_version);
|
warn("strdup");
|
||||||
*device = strdup(_device);
|
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) {
|
if (*manuf == NULL || *version == NULL || *device == NULL) {
|
||||||
warn("strdup");
|
warn("strdup");
|
||||||
goto err;
|
goto err;
|
||||||
|
Loading…
Reference in New Issue
Block a user