]> err.no Git - systemd/commitdiff
fix uninitialized name_list error::ignore_error
authorAlan Jenkins <alan-jenkins@tuffmail.co.uk>
Mon, 1 Sep 2008 14:36:43 +0000 (16:36 +0200)
committerKay Sievers <kay.sievers@vrfy.org>
Mon, 1 Sep 2008 14:36:43 +0000 (16:36 +0200)
Running udevd under valgrind (and then udevtrigger):

==17705== Conditional jump or move depends on uninitialised value(s)
==17705==    at 0x407BBB: udev_rules_run (udev_rules.c:522)
==17705==    by 0x4109F0: udev_event_process (udevd.c:145)
==17705==    by 0x410E2C: udev_event_run (udevd.c:251)
==17705==    by 0x411A8D: msg_queue_manager (udevd.c:581)
==17705==    by 0x41386B: main (udevd.c:1284)

Signed-off-by: Alan Jenkins <alan-jenkins@tuffmail.co.uk>
udev/udev_utils.c

index 9b22de783f1f86c4a18c28278c0cfa4bb6ec8b4e..f63a9fa1d038e14c2ba18429b273eb8665fcd89d 100644 (file)
@@ -77,7 +77,7 @@ struct name_entry *name_list_add(struct list_head *name_list, const char *name,
        name_new = malloc(sizeof(struct name_entry));
        if (name_new == NULL)
                return NULL;
-
+       memset(name_new, 0x00, sizeof(struct name_entry));
        strlcpy(name_new->name, name, sizeof(name_new->name));
        dbg("adding '%s'\n", name_new->name);
        list_add_tail(&name_new->node, &name_loop->node);
@@ -102,7 +102,7 @@ struct name_entry *name_list_key_add(struct list_head *name_list, const char *ke
        name_new = malloc(sizeof(struct name_entry));
        if (name_new == NULL)
                return NULL;
-
+       memset(name_new, 0x00, sizeof(struct name_entry));
        snprintf(name_new->name, sizeof(name_new->name), "%s=%s", key, value);
        name_new->name[sizeof(name_new->name)-1] = '\0';
        dbg("adding '%s'\n", name_new->name);