mirror of
https://source.denx.de/u-boot/u-boot.git
synced 2026-06-13 15:03:58 +03:00
common/cli.c: use memdup_nul() in run_command_list()
Use memdup_nul() instead of open-coding it. Reviewed-by: Simon Glass <sjg@chromium.org> Signed-off-by: Rasmus Villemoes <ravi@prevas.dk>
This commit is contained in:
committed by
Tom Rini
parent
b87ff4878d
commit
11168813bf
@@ -138,11 +138,9 @@ int run_command_list(const char *cmd, int len, int flag)
|
||||
#endif
|
||||
}
|
||||
if (need_buff) {
|
||||
buff = malloc(len + 1);
|
||||
buff = memdup_nul(cmd, len);
|
||||
if (!buff)
|
||||
return 1;
|
||||
memcpy(buff, cmd, len);
|
||||
buff[len] = '\0';
|
||||
}
|
||||
#ifdef CONFIG_HUSH_PARSER
|
||||
if (use_hush_old()) {
|
||||
|
||||
Reference in New Issue
Block a user