After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 569627 - memory leak in _vte_keymap_map() in src/keymap.c
memory leak in _vte_keymap_map() in src/keymap.c
Status: RESOLVED DUPLICATE of bug 169295
Product: vte
Classification: Core
Component: general
unspecified
Other Linux
: Normal normal
: ---
Assigned To: VTE Maintainers
VTE Maintainers
Depends on:
Blocks:
 
 
Reported: 2009-01-29 03:48 UTC by Hiroyuki Ikezoe
Modified: 2014-04-22 16:28 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
The patch file (883 bytes, patch)
2009-01-29 03:48 UTC, Hiroyuki Ikezoe
none Details | Review

Description Hiroyuki Ikezoe 2009-01-29 03:48:25 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);
Comment 1 Hiroyuki Ikezoe 2009-01-29 03:48:52 UTC
Created attachment 127429 [details] [review]
The patch file
Comment 2 Christian Persch 2009-04-29 19:55:27 UTC
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...)
Comment 3 Christian Persch 2014-04-22 16:28:43 UTC
Obsoleted by the fix for bug 169295.

*** This bug has been marked as a duplicate of bug 169295 ***