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

PATCH: valgrind complains about init_keymaps



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



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