cmd: pxe: use strdup to copy config
Replace malloc and strcpy by strdup in function parse_label_kernel. Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com> Reviewed-by: Neil Armstrong <neil.armstrong@linaro.org>
This commit is contained in:
parent
a5dacef738
commit
51c5c28af5
@ -1179,11 +1179,10 @@ static int parse_label_kernel(char **c, struct pxe_label *label)
|
||||
if (!s)
|
||||
return 1;
|
||||
|
||||
label->config = malloc(strlen(s) + 1);
|
||||
label->config = strdup(s);
|
||||
if (!label->config)
|
||||
return -ENOMEM;
|
||||
|
||||
strcpy(label->config, s);
|
||||
*s = 0;
|
||||
|
||||
return 1;
|
||||
|
Loading…
Reference in New Issue
Block a user