From 6c312b0d1ea9faf8161f0dbaaea67d54ba4c401d Mon Sep 17 00:00:00 2001 From: Peter Krempa Date: Fri, 7 Mar 2014 11:38:18 +0100 Subject: [PATCH] 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. --- src/util/virstoragefile.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/util/virstoragefile.c b/src/util/virstoragefile.c index c7384d1dc4..8370d23550 100644 --- a/src/util/virstoragefile.c +++ b/src/util/virstoragefile.c @@ -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)