[libvirt] [PATCH 1/2] util: mdev: Use a local variable instead of an invalid pointer reference

Laine Stump laine at laine.org
Wed May 3 15:27:46 UTC 2017

On 04/28/2017 03:46 AM, Erik Skultety wrote:
> virMediatedDeviceListAdd calls VIR_APPEND_ELEMENT which normally clears
> the element to be added, thus the pointer must not be used afterwards,
> but because the pointer here is passed by value, what gets cleared is
> a copy of the original pointer that got created on the stack
> automatically when calling the function. The fact that it works now is
> just a coincidence and a bug in virMediatedDeviceListAdd that needs to
> be fixed in a separate commit. Therefore, use a local variable to hold
> data, rather than accessing the pointer later.
> Signed-off-by: Erik Skultety <eskultet at redhat.com>

Reviewed-by: Laine Stump <laine at laine.org>

(Oh, and "safe for freeze", in case that wasn't assumed. Same goes for 2/2)

More information about the libvir-list mailing list