tests/hd-geo-test: Don't pass NULL to unlink()
authorPeter Maydell <peter.maydell@linaro.org>
Fri, 5 Aug 2016 10:03:12 +0000 (11:03 +0100)
committerPeter Maydell <peter.maydell@linaro.org>
Thu, 8 Sep 2016 09:43:58 +0000 (10:43 +0100)
The unlink() function doesn't accept a NULL pointer, so
don't pass it one. Spotted by the clang sanitizer.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: John Snow <jsnow@redhat.com>
Message-id: 1470391392-28274-1-git-send-email-peter.maydell@linaro.org

tests/hd-geo-test.c

index 12ee3929daf0016cd7d74b6ce9abafaa1fda9c19..6176e81ab25e0682a2143f57299220fc840f8742 100644 (file)
@@ -416,7 +416,9 @@ int main(int argc, char **argv)
     ret = g_test_run();
 
     for (i = 0; i < backend_last; i++) {
-        unlink(img_file_name[i]);
+        if (img_file_name[i]) {
+            unlink(img_file_name[i]);
+        }
     }
 
     return ret;