summaryrefslogtreecommitdiff
path: root/udev/lib/libudev-device.c
diff options
context:
space:
mode:
Diffstat (limited to 'udev/lib/libudev-device.c')
-rw-r--r--udev/lib/libudev-device.c4
1 files changed, 2 insertions, 2 deletions
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;