Ticket #2108: 2108-lib-vfs-mc-vfs-fish.c-src-editor-edit.c-miss-g_free.patch

File 2108-lib-vfs-mc-vfs-fish.c-src-editor-edit.c-miss-g_free.patch, 2.0 KB (added by vit_r, 15 years ago)

lib-vfs-mc-vfs-fish.c-src-editor-edit.c-missing-g_free

  • lib/vfs/mc-vfs/fish.c

    From 6af62610eedd446a29f94508cde1e4409b593505 Mon Sep 17 00:00:00 2001
    From: Vit Rosin <vit_r@list.ru>
    Date: Tue, 16 Mar 2010 21:59:29 +0000
    Subject: [PATCH]  lib/vfs/mc-vfs/fish.c src/editor/edit.c missing g_free
    
    ---
     lib/vfs/mc-vfs/fish.c |    3 ++-
     src/editor/edit.c     |   13 +++++++++++--
     2 files changed, 13 insertions(+), 3 deletions(-)
    
    diff --git a/lib/vfs/mc-vfs/fish.c b/lib/vfs/mc-vfs/fish.c
    index 317ece2..b9e32e7 100644
    a b fish_linear_start (struct vfs_class *me, struct vfs_s_fh *fh, off_t offset) 
    821821    name = vfs_s_fullpath (me, fh->ino); 
    822822    if (!name) 
    823823        return 0; 
    824     quoted_name = strutils_shell_escape(name); 
     824    quoted_name = strutils_shell_escape (name); 
     825    g_free (name); 
    825826    fh->u.fish.append = 0; 
    826827 
    827828    /* 
  • src/editor/edit.c

    diff --git a/src/editor/edit.c b/src/editor/edit.c
    index b88e294..1d0408c 100644
    a b int edit_get_utf (WEdit * edit, long byte_index, int *char_width) 
    208208            width = 0; 
    209209        } 
    210210    } 
     211    g_free (str); 
    211212    *char_width = width; 
    212213    return ch; 
    213214} 
    int edit_get_prev_utf (WEdit * edit, long byte_index, int *char_width) 
    236237    } 
    237238 
    238239    str = edit_get_byte_ptr (edit, byte_index); 
    239     buf = edit_get_buf_ptr (edit, byte_index); 
    240     if (str == NULL || buf == NULL) { 
     240    if (str == NULL) { 
    241241        *char_width = 0; 
    242242        return 0; 
    243243    } 
     244    buf = edit_get_buf_ptr (edit, byte_index); 
     245    if (buf == NULL) { 
     246        g_free (str); 
     247        *char_width = 0;     
     248        return 0; 
     249    } 
    244250    /* get prev utf8 char */ 
    245251    if (str != buf) 
    246252        str = g_utf8_find_prev_char (buf, str); 
    247253 
     254    g_free (buf); 
     255 
    248256    res = g_utf8_get_char_validated (str, -1); 
    249257 
    250258    if (res < 0) { 
    int edit_get_prev_utf (WEdit * edit, long byte_index, int *char_width) 
    261269            width = 0; 
    262270        } 
    263271    } 
     272    g_free (str); 
    264273    *char_width = width; 
    265274    return ch; 
    266275}