If the allocation fails in DO_TEST_FLUSH_PROLOGUE, then 'mgr == NULL', but the code continues on - which won't be good. So modify the macro to cause an immediate failure and jump to a cleanup label. Found by Coverity as FORWARD_NULL event. Signed-off-by: John Ferlan <jferlan@xxxxxxxxxx> --- tests/virmacmaptest.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/tests/virmacmaptest.c b/tests/virmacmaptest.c index 34609ad..4daa048 100644 --- a/tests/virmacmaptest.c +++ b/tests/virmacmaptest.c @@ -170,8 +170,12 @@ mymain(void) } while (0) #define DO_TEST_FLUSH_PROLOGUE \ - if (!(mgr = virMacMapNew(NULL))) \ - ret = -1; + do { \ + if (!(mgr = virMacMapNew(NULL))) { \ + ret = -1; \ + goto cleanup; \ + } \ + } while (0) #define DO_TEST_FLUSH(d, ...) \ do { \ @@ -226,6 +230,7 @@ mymain(void) DO_TEST_FLUSH("dom1", "9e:89:49:99:51:0e", "89:b4:3f:08:88:2c", "54:0b:4c:e2:0a:39"); DO_TEST_FLUSH("dom1", "bb:88:07:19:51:9d", "b7:f1:1a:40:a2:95", "88:94:39:a3:90:b4"); DO_TEST_FLUSH_EPILOGUE("complex"); + cleanup: return ret == 0 ? EXIT_SUCCESS : EXIT_FAILURE; } -- 2.7.4 -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list