Ticket #2069: 2069-missing-mc_config_deinit-vfs_s_close-g_free.patch

File 2069-missing-mc_config_deinit-vfs_s_close-g_free.patch, 3.6 KB (added by vit_r, 14 years ago)
  • lib/mcconfig/common.c

    From f753fb306e19f00b83e0aa2007cd1903311e3b1e Mon Sep 17 00:00:00 2001
    From: Vit Rosin <vit_r@list.ru>
    Date: Sun, 28 Feb 2010 20:48:12 +0000
    Subject: [PATCH]  missing mc_config_deinit vfs_s_close g_free
    
    ---
     lib/mcconfig/common.c     |    8 ++++----
     lib/skin/colors.c         |    8 +++++---
     lib/vfs/mc-vfs/direntry.c |    6 +++++-
     src/editor/editcmd.c      |    9 ++++++++-
     4 files changed, 22 insertions(+), 9 deletions(-)
    
    diff --git a/lib/mcconfig/common.c b/lib/mcconfig/common.c
    index dd0cb4e..f8fd5f7 100644
    a b mc_config_read_file (mc_config_t * mc_config, const gchar * ini_path) 
    195195    gchar **keys, **curr_key; 
    196196    gchar *value; 
    197197 
    198     if (mc_config == NULL) { 
     198    if (mc_config == NULL) 
    199199        return FALSE; 
    200     } 
    201200 
    202201    tmp_config = mc_config_init (ini_path); 
    203202    if (tmp_config == NULL) 
    mc_config_read_file (mc_config_t * mc_config, const gchar * ini_path) 
    205204 
    206205    groups = mc_config_get_groups (tmp_config, NULL); 
    207206 
    208     if (groups == NULL) 
     207    if (groups == NULL) { 
     208        mc_config_deinit (tmp_config); 
    209209        return FALSE; 
    210  
     210    } 
    211211    for (curr_grp = groups; *curr_grp != NULL; curr_grp++) { 
    212212        keys = mc_config_get_keys (tmp_config, *curr_grp, NULL); 
    213213        for (curr_key = keys; *curr_key != NULL; curr_key++) { 
  • lib/skin/colors.c

    diff --git a/lib/skin/colors.c b/lib/skin/colors.c
    index 22f6c1a..c8c73df 100644
    a b mc_skin_color_get_from_ini_file (mc_skin_t * mc_skin, const gchar * group, const 
    127127 
    128128    values = mc_config_get_string_list (mc_skin->config, group, key, &items_count); 
    129129 
    130     if (values == NULL || *values == NULL) { 
    131         if (values != NULL) 
    132             g_strfreev (values); 
     130    if (values == NULL) 
     131        return NULL; 
     132 
     133    if (*values == NULL) { 
     134        g_strfreev (values); 
    133135        return NULL; 
    134136    } 
    135137    mc_skin_color = g_try_new0 (mc_skin_color_t, 1); 
  • lib/vfs/mc-vfs/direntry.c

    diff --git a/lib/vfs/mc-vfs/direntry.c b/lib/vfs/mc-vfs/direntry.c
    index 83cd050..ef87218 100644
    a b vfs_s_getlocalcopy (struct vfs_class *me, const char *path) 
    10451045    char *local; 
    10461046 
    10471047    fh = vfs_s_open (me, path, O_RDONLY, 0); 
    1048     if (!fh || !fh->ino || !fh->ino->localname) 
     1048    if (fh == NULL) 
    10491049        return NULL; 
    10501050 
     1051    if (fh->ino == NULL || fh->ino->localname == NULL) { 
     1052        vfs_s_close (fh); 
     1053        return NULL;     
     1054    } 
    10511055    local = g_strdup (fh->ino->localname); 
    10521056    vfs_s_close (fh); 
    10531057    return local; 
  • src/editor/editcmd.c

    diff --git a/src/editor/editcmd.c b/src/editor/editcmd.c
    index 81331e9..dc13f6a 100644
    a b edit_search_cmd (WEdit * edit, int again) 
    19271927        if (search_string && *search_string) 
    19281928        { 
    19291929            tmp = str_convert_to_input (search_string); 
     1930 
     1931            g_free (search_string); 
     1932            search_string = NULL; 
     1933 
    19301934            if (tmp && tmp->len) 
    19311935                search_string = tmp->str; 
    19321936 
    edit_search_cmd (WEdit * edit, int again) 
    19591963        if (edit->search == NULL) 
    19601964        { 
    19611965            edit->search_start = edit->curs1; 
     1966            g_free (search_string); 
    19621967            return; 
    19631968        } 
    19641969        edit->search->search_type = edit_search_options.type; 
    edit_search_cmd (WEdit * edit, int again) 
    19671972        edit->search->whole_words = edit_search_options.whole_words; 
    19681973        edit->search->search_fn = edit_search_cmd_callback; 
    19691974    } 
    1970  
     1975    if (search_string) 
     1976        g_free (search_string); 
     1977         
    19711978    if (search_create_bookmark) 
    19721979    { 
    19731980        edit_search_cmd_search_create_bookmark (edit);