elflink: Fix the wrong malloc size in enter_cmdline
authorLiu Aleaxander <Aleaxander@gmail.com>
Tue, 15 Mar 2011 20:24:57 +0000 (20:24 +0000)
committerMatt Fleming <matt.fleming@linux.intel.com>
Tue, 15 Mar 2011 21:14:27 +0000 (21:14 +0000)
Signed-off-by: Liu Aleaxander <Aleaxander@gmail.com>
Signed-off-by: Matt Fleming <matt.fleming@linux.intel.com>
com32/elflink/ldlinux/cli.c

index 77d32cd..b35e958 100644 (file)
@@ -369,9 +369,8 @@ void process_command(const char *cmd, bool history)
        if (history) {
                struct cli_command  *comm;
 
-               comm = (struct cli_command *)malloc(sizeof(struct cli_command *));
-               comm->command =
-                       (char *)malloc(sizeof(char) * (strlen(cmd) + 1));
+               comm = malloc(sizeof(struct cli_command));
+               comm->command = malloc(sizeof(char) * (strlen(cmd) + 1));
                strcpy(comm->command, cmd);
                list_add(&(comm->list), &cli_history_head);
        }