Fork us on GitHub Follow us on Facebook Follow us on Twitter

Changeset 01e397ac in mainline


Ignore:
Timestamp:
2012-08-17T17:00:34Z (9 years ago)
Author:
Martin Sucha <sucha14@…>
Branches:
lfn, master
Children:
2568c94, 7cfe5c0, efb94a77
Parents:
111d2d6
Message:

bdsh: Fix free() being called on incorrect pointer if the command started with spaces.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/app/bdsh/input.c

    r111d2d6 r01e397ac  
    6767int process_input(cliuser_t *usr)
    6868{
    69         token_t *tokens = calloc(WORD_MAX, sizeof(token_t));
    70         if (tokens == NULL)
     69        token_t *tokens_buf = calloc(WORD_MAX, sizeof(token_t));
     70        if (tokens_buf == NULL)
    7171                return ENOMEM;
     72        token_t *tokens = tokens_buf;
    7273       
    7374        char *cmd[WORD_MAX];
     
    8081
    8182        if (usr->line == NULL) {
    82                 free(tokens);
     83                free(tokens_buf);
    8384                return CL_EFAIL;
    8485        }
     
    213214        }
    214215        tok_fini(&tok);
    215         free(tokens);
     216        free(tokens_buf);
    216217
    217218        return rc;
Note: See TracChangeset for help on using the changeset viewer.