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;
char **udev_device_get_properties_envp(struct udev_device *udev_device)
{
if (!udev_device->envp_uptodate)
- if (update_envp_monitor_buf(udev_device) < 32)
+ if (update_envp_monitor_buf(udev_device) != 0)
return NULL;
return udev_device->envp;
}
ssize_t udev_device_get_properties_monitor_buf(struct udev_device *udev_device, const char **buf)
{
if (!udev_device->envp_uptodate)
- if (update_envp_monitor_buf(udev_device) < 32)
+ if (update_envp_monitor_buf(udev_device) != 0)
return -EINVAL;
*buf = udev_device->monitor_buf;
return udev_device->monitor_buf_len;