
3 May
2017
3 May
'17
11:27 a.m.
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@redhat.com>
Reviewed-by: Laine Stump <laine@laine.org> (Oh, and "safe for freeze", in case that wasn't assumed. Same goes for 2/2)