[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: [libvirt] [PATCH] Correct two memory leaks triggered by udev events



On 05/28/10 - 11:13:29PM, Dave Allan wrote:
> diff --git a/src/node_device/node_device_udev.c b/src/node_device/node_device_udev.c
> index 6e3ecd7..5193f5b 100644
> --- a/src/node_device/node_device_udev.c
> +++ b/src/node_device/node_device_udev.c
> @@ -1211,6 +1211,8 @@ static int udevRemoveOneDevice(struct udev_device *device)
>      }
>      nodeDeviceUnlock(driverState);
> 
> +    udev_device_unref(device);
> +
>      return ret;
>  }

Instead of adding the udev_device_unref here and in in udevAddOneDevice, I
think we should probably just put it in the udevEventHandleCallback() and
udevProcessDeviceListEntry().  Besides the fact that it is easier to read and
verify that you've dropped the reference, if udev ever grows new actions
besides "add", "change", or "remove", we'll go back to leaking the reference.

--
Chris Lalancette


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]