[syslinux:elflink] hdt-cli: Correct malloc() size argument
syslinux-bot for Matt Fleming
matt.fleming at intel.com
Tue Nov 27 14:15:04 PST 2012
Commit-ID: d43c57d945f42dd0dbaca747a646a769e49082da
Gitweb: http://www.syslinux.org/commit/d43c57d945f42dd0dbaca747a646a769e49082da
Author: Matt Fleming <matt.fleming at intel.com>
AuthorDate: Fri, 16 Nov 2012 14:23:45 +0000
Committer: Matt Fleming <matt.fleming at intel.com>
CommitDate: Tue, 27 Nov 2012 20:47:28 +0000
hdt-cli: Correct malloc() size argument
We need to be allocating sizeof(char *) (4) not sizeof(char) (1) for
'new_argv'.
Cc: Erwan Velu <erwanaliasr1 at gmail.com>
Signed-off-by: Matt Fleming <matt.fleming at intel.com>
---
com32/hdt/hdt-cli.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/com32/hdt/hdt-cli.c b/com32/hdt/hdt-cli.c
index 7542da8..216b6bd 100644
--- a/com32/hdt/hdt-cli.c
+++ b/com32/hdt/hdt-cli.c
@@ -649,7 +649,7 @@ static void exec_command(char *line, struct s_hardware *hardware)
if ((current_module->nomodule == true) && ( module != NULL)) {
dprintf("CLI_DEBUG exec: Reworking arguments with argc=%d\n",argc);
char **new_argv=NULL;
- new_argv=malloc((argc + 2)*sizeof(char));
+ new_argv=malloc((argc + 2)*sizeof(char *));
for (int argc_iter=0; argc_iter<argc; argc_iter++) {
dprintf("CLI_DEBUG exec rework : copy %d to %d (%s)\n",argc_iter,argc_iter+1,argv[argc_iter]);
new_argv[argc_iter+1] = malloc(strlen(argv[argc_iter]));
More information about the Syslinux-commits
mailing list