diff options
| author | Mattias Andrée <maandree@operamail.com> | 2013-07-10 02:13:27 +0200 | 
|---|---|---|
| committer | Mattias Andrée <maandree@operamail.com> | 2013-07-10 02:13:27 +0200 | 
| commit | de6d4f71e520f5870251099c2b4c6e1200b01f1f (patch) | |
| tree | ae61a7526d154bfed82ac170b87209a84e862bf0 | |
| parent | derp (diff) | |
| download | argparser-de6d4f71e520f5870251099c2b4c6e1200b01f1f.tar.gz argparser-de6d4f71e520f5870251099c2b4c6e1200b01f1f.tar.bz2 argparser-de6d4f71e520f5870251099c2b4c6e1200b01f1f.tar.xz  | |
m
Signed-off-by: Mattias Andrée <maandree@operamail.com>
| -rw-r--r-- | src/argparser.c | 13 | 
1 files changed, 9 insertions, 4 deletions
diff --git a/src/argparser.c b/src/argparser.c index 9631dfe..b067949 100644 --- a/src/argparser.c +++ b/src/argparser.c @@ -160,7 +160,12 @@ void args_dispose()    if (args_program_dispose)      free(args_program);    if (args_options != null) -    free(args_options); +    { +      long i; +      for (i = 0; i < args_options_count; i++) +	free((*(args_options + i)).alternatives); +      free(args_options); +    }    args_files = null;    args_message = null; @@ -1523,7 +1528,7 @@ static void map_put(args_Map* map, char* key, void* value)      }    *(at + 16) = value;    if (new) -    map->keys = realloc(map->keys, (map->key_count + 1) * sizeof(char**)); +    map->keys = (char**)realloc(map->keys, (map->key_count + 1) * sizeof(char*));  }  /** @@ -1534,12 +1539,12 @@ static void map_put(args_Map* map, char* key, void* value)   */  static void _map_free(void** level, long has_value)  { -  long i; +  long next_has_value = has_value ^ true, i;    void* value;    if (level == null)      return;    for (i = 0; i < 16; i++) -    free(*(level + i)); +    _map_free(*(level + i), next_has_value);    if (has_value)      if ((value = *(level + 16)))        {  | 
