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:
Patrick Delaunay 2022-10-28 11:01:20 +02:00 committed by Tom Rini
parent a5dacef738
commit 51c5c28af5

View File

@ -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;