diff --git a/tests/virmacmaptest.c b/tests/virmacmaptest.c index 34609ad44a7f97cfee48f8a22288b2cd0b910be4..4daa0488483937cf6fd5db9d9084ae80a30e9506 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; }