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 authored and Tom Rini committed 2022-12-12 14:03:12 -05:00
1 parent a5dacef738
commit 51c5c28af5
1 file changed
+1 -2
+1 -2
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;