Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

PATCH: bindkey resource leak



Either of these run repeatedly will increment the reference counter for
the "thingy". The first case is CID 107. I don't think coverity picked
up on the second case.

bindkey -R B-A thingy
bindkey '' thingy

Oliver

Index: Src/Zle/zle_keymap.c
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/Zle/zle_keymap.c,v
retrieving revision 1.29
diff -u -r1.29 zle_keymap.c
--- Src/Zle/zle_keymap.c	3 Apr 2008 15:20:24 -0000	1.29
+++ Src/Zle/zle_keymap.c	11 Nov 2008 16:17:43 -0000
@@ -918,11 +918,12 @@
 		    metafy(m, 1, META_NOALLOC);
 		    bindkey(km, m, refthingy(fn), str);
 		}
-		unrefthingy(fn);
 	    }
+	    unrefthingy(fn);
 	} else {
 	    if(bindkey(km, seq, fn, str)) {
 		zwarnnam(name, "cannot bind to an empty key sequence");
+		unrefthingy(fn);
 		ret = 1;
 	    }
 	}




Messages sorted by: Reverse Date, Date, Thread, Author