Ticket #1855: 1855-missing-check-in-src_mcconfig_get.c-mc_config_-2.patch

File 1855-missing-check-in-src_mcconfig_get.c-mc_config_-2.patch, 3.3 KB (added by vit_r, 15 years ago)

enveloping previous patch for discussing

  • src/filehighlight/ini-file-read.c

    From 28c2cae07f03c0b5f86d894a6c692136a28b37f7 Mon Sep 17 00:00:00 2001
    From: Vit Rosin <vit_r@list.ru>
    Date: Thu, 3 Dec 2009 14:58:31 +0000
    Subject: [PATCH] missing check in src_mcconfig_get.c-mc_config_get_groups()_-2
    
    ---
     src/filehighlight/ini-file-read.c |    3 +--
     src/mcconfig/common.c             |    2 ++
     src/mcconfig/get.c                |    3 +--
     src/setup.c                       |    3 +--
     src/skin/colors.c                 |    3 +--
     5 files changed, 6 insertions(+), 8 deletions(-)
    
    diff --git a/src/filehighlight/ini-file-read.c b/src/filehighlight/ini-file-read.c
    index b2f4901..4aee22a 100644
    a b gboolean 
    243243mc_fhl_parse_ini_file (mc_fhl_t * fhl) 
    244244{ 
    245245    gchar **group_names, **orig_group_names; 
    246     gsize ftype_names_size; 
    247246 
    248247    mc_fhl_array_free (fhl); 
    249248    fhl->filters = g_ptr_array_new (); 
    250249 
    251     orig_group_names = group_names = mc_config_get_groups (fhl->config, &ftype_names_size); 
     250    orig_group_names = group_names = mc_config_get_groups (fhl->config, NULL); 
    252251 
    253252    if (group_names == NULL) 
    254253        return FALSE; 
  • src/mcconfig/common.c

    diff --git a/src/mcconfig/common.c b/src/mcconfig/common.c
    index b0999ba..d7233f9 100644
    a b mc_config_read_file (mc_config_t * mc_config, const gchar * ini_path) 
    208208        return FALSE; 
    209209 
    210210    groups = mc_config_get_groups (tmp_config, NULL); 
     211    if (!groups) 
     212        return FALSE; 
    211213 
    212214    for (curr_grp = groups; *curr_grp != NULL; curr_grp++) { 
    213215        keys = mc_config_get_keys (tmp_config, *curr_grp, NULL); 
  • src/mcconfig/get.c

    diff --git a/src/mcconfig/get.c b/src/mcconfig/get.c
    index 693ebf4..a7bdf34 100644
    a b mc_config_get_groups (mc_config_t * mc_config, gsize * len) 
    4545 
    4646    if (!mc_config) 
    4747    { 
    48         ret = g_try_malloc0 (sizeof (gchar **)); 
    4948        if (len) 
    5049            *len = 0; 
    51         return ret; 
     50        return NULL; 
    5251    } 
    5352    ret = g_key_file_get_groups (mc_config->handle, len); 
    5453    if (ret == NULL) 
  • src/setup.c

    diff --git a/src/setup.c b/src/setup.c
    index 3f7adca..7b7cee1 100644
    a b setup__move_panels_config_into_separate_file(const char*profile) 
    492492    mc_config_t *tmp_cfg; 
    493493    char **groups, **curr_grp; 
    494494    const char *need_grp; 
    495     gsize groups_count; 
    496495 
    497496    if (!exist_file(profile)) 
    498497        return; 
    setup__move_panels_config_into_separate_file(const char*profile) 
    501500    if (!tmp_cfg) 
    502501        return; 
    503502 
    504     curr_grp = groups = mc_config_get_groups (tmp_cfg, &groups_count); 
     503    curr_grp = groups = mc_config_get_groups (tmp_cfg, NULL); 
    505504    if (!groups) 
    506505    { 
    507506        mc_config_deinit(tmp_cfg); 
  • src/skin/colors.c

    diff --git a/src/skin/colors.c b/src/skin/colors.c
    index e4dd66b..d595bb5 100644
    a b mc_skin_color_check_inisection (const gchar * group) 
    250250static void 
    251251mc_skin_color_check_bw_mode (mc_skin_t * mc_skin) 
    252252{ 
    253     gsize items_count; 
    254253    gchar **groups, **orig_groups; 
    255254 
    256255    if (!mc_args__disable_colors) 
    257256        return; 
    258257 
    259     orig_groups = groups = mc_config_get_groups (mc_skin->config, &items_count); 
     258    orig_groups = groups = mc_config_get_groups (mc_skin->config, NULL); 
    260259 
    261260    if (groups == NULL) 
    262261        return;