On 04/07/2014 02:22 AM, Peter Krempa wrote:
On 04/06/14 05:32, Eric Blake wrote:
> I noticed that the apparmor code could request metadata even
> for a cdrom with no media, which would cause a memory leak of
> the hash table used to look for loops in the backing chain.
> But even before that, we blindly dereferenced the path for
> printing a debug statement, so it is just better to enforce
> that this is only used on non-NULL names.
>
> +++ b/src/util/virstoragefile.c
> @@ -1142,9 +1142,9 @@ virStorageFileGetMetadata(const char *path, int format,
> path, format, (int)uid, (int)gid, allow_probe);
>
> virHashTablePtr cycle = virHashCreate(5, NULL);
> - virStorageFileMetadataPtr ret;
> + virStorageFileMetadataPtr ret = NULL;
This assignment will always be overwritten or unused.
Leftovers from a different approach I had tried. I dropped this change...
>
> - if (!cycle || !path)
> + if (!cycle)
> return NULL;
>
> if (format <= VIR_STORAGE_FILE_NONE)
ACK,
and pushed.
--
Eric Blake eblake redhat com +1-919-301-3266
Libvirt virtualization library
http://libvirt.org