util: storagefile: Don't pursue backing chain of NULL image

When virStorageFileGetMetadata is called with NULL path argument, the
invalid pointer boils down through the recursive worker and is caught by
virHashAddEntry which is thankfully resistant to NULL arguments. As it
doesn't make sense to pursue backing chains of NULL volumes, exit
earlier.

This was noticed in the virt-aahelper-test with a slightly modified
codebase.
This commit is contained in:
Peter Krempa 2014-03-07 11:38:18 +01:00
parent ce5ec2f1da
commit 6c312b0d1e

View File

@ -1118,7 +1118,7 @@ virStorageFileGetMetadata(const char *path, int format,
virHashTablePtr cycle = virHashCreate(5, NULL);
virStorageFileMetadataPtr ret;
if (!cycle)
if (!cycle || !path)
return NULL;
if (format <= VIR_STORAGE_FILE_NONE)