GNOME Bugzilla – Bug 569627
memory leak in _vte_keymap_map() in src/keymap.c
Last modified: 2014-04-22 16:28:43 UTC
memory leak in _vte_keymap_map() in src/keymap.c. Index: src/keymap.c =================================================================== --- src/keymap.c (revision 2365) +++ src/keymap.c (working copy) @@ -1165,12 +1165,12 @@ _vte_keymap_map(guint keyval, } } if (termcap_special != NULL) { - tmp = g_strdup(terminal); cap = NULL; - if (tgetent(ncurses_buffer, tmp) == 1) { + if (tgetent(ncurses_buffer, terminal) == 1) { cap = ncurses_area; tmp = g_strdup(termcap_special); cap = tgetstr(tmp, &cap); + g_free(tmp); } if ((cap == NULL) && (strstr(terminal, "xterm") != NULL)) { /* try, try again */ @@ -1178,9 +1178,9 @@ _vte_keymap_map(guint keyval, cap = ncurses_area; tmp = g_strdup(termcap_special); cap = tgetstr(tmp, &cap); + g_free(tmp); } } - g_free(tmp); if ((cap != NULL) && (*cap != '\0')) { *normal_length = strlen(cap); *normal = g_strdup(cap);
Created attachment 127429 [details] [review] The patch file
Looks ok to me. (The existing code is a bit strange though, what's up with cap = ncurses_area; tmp = g_strdup(termcap_special); cap = tgetstr(tmp, &cap); + g_free(tmp); pattern? I don't see anything that suggests tgetstr would modify the string in the 1st arg...)
Obsoleted by the fix for bug 169295. *** This bug has been marked as a duplicate of bug 169295 ***