qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] tests/hd-geo-test: Don't pass NULL to unlink()
@ 2016-08-05 10:03 Peter Maydell
  2016-08-05 11:19 ` Markus Armbruster
                   ` (2 more replies)
  0 siblings, 3 replies; 9+ messages in thread
From: Peter Maydell @ 2016-08-05 10:03 UTC (permalink / raw)
  To: qemu-devel; +Cc: patches

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>
---
 tests/hd-geo-test.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/tests/hd-geo-test.c b/tests/hd-geo-test.c
index 12ee392..6176e81 100644
--- a/tests/hd-geo-test.c
+++ b/tests/hd-geo-test.c
@@ -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;
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2016-09-08 10:28 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-08-05 10:03 [Qemu-devel] [PATCH] tests/hd-geo-test: Don't pass NULL to unlink() Peter Maydell
2016-08-05 11:19 ` Markus Armbruster
2016-08-05 11:57   ` Peter Maydell
2016-09-06 12:47 ` Peter Maydell
2016-09-06 19:06   ` John Snow
2016-09-06 19:07     ` Peter Maydell
2016-09-06 19:15       ` John Snow
2016-09-06 19:52         ` Peter Maydell
2016-09-08 10:27 ` Peter Maydell

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).