]> asedeno.scripts.mit.edu Git - PuTTY.git/commitdiff
Fix a memory leak in parse_ttymodes() (found by Memcheck/Valgrind).
authorBen Harris <bjh21@bjh21.me.uk>
Mon, 27 Aug 2012 19:11:39 +0000 (19:11 +0000)
committerBen Harris <bjh21@bjh21.me.uk>
Mon, 27 Aug 2012 19:11:39 +0000 (19:11 +0000)
[originally from svn r9633]

ssh.c

diff --git a/ssh.c b/ssh.c
index bfc10b029fd0ba586325a313c12f72a7633a04b7..bdab733f269fcd90937cf9fa169111a3dd973fef 100644 (file)
--- a/ssh.c
+++ b/ssh.c
@@ -1062,12 +1062,14 @@ static void parse_ttymodes(Ssh ssh,
         * follows it, or 'A' indicating that we should pass the
         * value through from the local environment via get_ttymode.
         */
-       if (val[0] == 'A')
+       if (val[0] == 'A') {
            val = get_ttymode(ssh->frontend, key);
-       else
-           val++;                     /* skip the 'V' */
-       if (val)
-           do_mode(data, key, val);
+           if (val) {
+               do_mode(data, key, val);
+               sfree(val);
+           }
+       } else
+           do_mode(data, key, val + 1);               /* skip the 'V' */
     }
 }