zsh-workers
 help / color / mirror / code / Atom feed
* PATCH: valgrind complains about init_keymaps
@ 2011-12-20 16:38 Bart Schaefer
  0 siblings, 0 replies; only message in thread
From: Bart Schaefer @ 2011-12-20 16:38 UTC (permalink / raw)
  To: zsh-workers

While testing something else I accidentally executed a command out of my
history that started up my latest zsh build under valgrind.  Got a bunch
of these:

==10918== Conditional jump or move depends on uninitialised value(s)
==10918==    at 0x80C5593: metafy (utils.c:3962)
==10918==    by 0x810F9F2: bindkey (zle_keymap.c:547)
==10918==    by 0x811123C: add_cursor_key (zle_keymap.c:1253)
==10918==    by 0x8111540: default_bindings (zle_keymap.c:1329)
==10918==    by 0x81110E4: init_keymaps (zle_keymap.c:1192)

==10918== Conditional jump or move depends on uninitialised value(s)
==10918==    at 0x4005E89: strlen (mac_replace_strmem.c:243)
==10918==    by 0x80B3EFF: ztrdup (string.c:52)
==10918==    by 0x810FA24: bindkey (zle_keymap.c:548)
==10918==    by 0x811123C: add_cursor_key (zle_keymap.c:1253)
==10918==    by 0x8111540: default_bindings (zle_keymap.c:1329)
==10918==    by 0x81110E4: init_keymaps (zle_keymap.c:1192)

There are several more all of which have in common zle_keymap.c:548 or
zle_keymap.c:547

    542     if(!bind || ztrlen(seq) > 1) {
    543         /* key needs to become a prefix if isn't one already */
    544         if(km->first[f]) {
    545             char fs[3];
    546             fs[0] = f;
    547             metafy(fs, 1, META_NOALLOC);
    548             km->multi->addnode(km->multi, ztrdup(fs),
    549                 makekeynode(km->first[f], NULL));
    550             km->first[f] = NULL;
    551         }

Index: Src/Zle/zle_keymap.c
===================================================================
diff -u -r1.19 zle_keymap.c
--- Src/Zle/zle_keymap.c        21 Dec 2010 16:41:16 -0000      1.19
+++ Src/Zle/zle_keymap.c        20 Dec 2011 16:34:32 -0000
@@ -544,6 +544,7 @@
        if(km->first[f]) {
            char fs[3];
            fs[0] = f;
+           fs[1] = 0;
            metafy(fs, 1, META_NOALLOC);
            km->multi->addnode(km->multi, ztrdup(fs),
                makekeynode(km->first[f], NULL));

-- 
Barton E. Schaefer


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2011-12-20 16:38 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-12-20 16:38 PATCH: valgrind complains about init_keymaps Bart Schaefer

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).