]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
cmd: pxe: use strdup to copy config
authorPatrick Delaunay <patrick.delaunay@foss.st.com>
Fri, 28 Oct 2022 09:01:20 +0000 (11:01 +0200)
committerTom Rini <trini@konsulko.com>
Mon, 12 Dec 2022 19:03:12 +0000 (14:03 -0500)
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>
boot/pxe_utils.c

index b59e959f715fdb8eac7b751686a6bf3ba060da05..c613818d0b34982df40c3adaef9ec593d706be29 100644 (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;