]> err.no Git - systemd/commitdiff
libudev: device - allocate envp array only once
authorKay Sievers <kay.sievers@vrfy.org>
Sun, 26 Oct 2008 13:31:46 +0000 (14:31 +0100)
committerKay Sievers <kay.sievers@vrfy.org>
Sun, 26 Oct 2008 13:31:46 +0000 (14:31 +0100)
test/udev-test.pl
udev/lib/libudev-device.c

index 096977a611044683ceeaad2ebe3200413b272b47..95f9af0e2b86e151722d28cdcfdd6a8aadbe77cc 100755 (executable)
@@ -1663,10 +1663,11 @@ EOF
                exp_name        => "sda-8741C4G-end",
                exp_perms       => "0:0:0660",
                rules           => <<EOF
+KERNEL=="sda", PROGRAM="/bin/true create-envp"
+KERNEL=="sda", ENV{TESTENV}="change-envp"
 KERNEL=="sda", NAME="%k-%s{[dmi/id]product_name}-end", RUN+="socket:@/org/kernel/udev/monitor"
 EOF
        },
-
 );
 
 # set env
index bad6e94de58f462a0e6fac888442f3e2b68eca69..11a6037d1b823006fd117568ff50037a846cd530 100644 (file)
@@ -1025,8 +1025,8 @@ static int update_envp_monitor_buf(struct udev_device *udev_device)
                return -ENOMEM;
 
        /* envp array, strings will point into monitor buffer */
-       free(udev_device->envp);
-       udev_device->envp = malloc(sizeof(char *) * ENVP_SIZE);
+       if (udev_device->envp == NULL)
+               udev_device->envp = malloc(sizeof(char *) * ENVP_SIZE);
        if (udev_device->envp == NULL)
                return -ENOMEM;