diff options
-rwxr-xr-x | test/udev-test.pl | 3 | ||||
-rw-r--r-- | udev/lib/libudev-device.c | 4 |
2 files changed, 4 insertions, 3 deletions
diff --git a/test/udev-test.pl b/test/udev-test.pl index 096977a611..95f9af0e2b 100755 --- a/test/udev-test.pl +++ b/test/udev-test.pl @@ -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 diff --git a/udev/lib/libudev-device.c b/udev/lib/libudev-device.c index bad6e94de5..11a6037d1b 100644 --- a/udev/lib/libudev-device.c +++ b/udev/lib/libudev-device.c @@ -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; |