cmd: pxe: use strdup to copy config
Replace malloc and strcpy by strdup in
function parse_label_kernel.
[Backport of commit 51c5c28af5
("cmd: pxe: use strdup to
copy config")]
Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Neil Armstrong <neil.armstrong@linaro.org>
Change-Id: I265e5843b2411596c17a0328e676c6e27ffc755d
This commit is contained in:
parent
707cc0f542
commit
d3567e68bd
1 changed files with 1 additions and 2 deletions
|
@ -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…
Add table
Reference in a new issue