test/cq-overflow: Don't call `io_uring_queue_exit()` if the ring is not initialized

Don't call `io_uring_queue_exit()` if the ring is not initialized.

Fix this:

  + valgrind -q ./cq-overflow.t
  file open: Invalid argument
  ==3054159== Use of uninitialised value of size 8
  ==3054159==    at 0x10A863: io_uring_queue_exit (setup.c:183)
  ==3054159==    by 0x1095DE: test_io.constprop.0 (cq-overflow.c:148)
  ==3054159==    by 0x109266: main (cq-overflow.c:269)
  ==3054159==
  ==3054159== Invalid read of size 4
  ==3054159==    at 0x10A863: io_uring_queue_exit (setup.c:183)
  ==3054159==    by 0x1095DE: test_io.constprop.0 (cq-overflow.c:148)
  ==3054159==    by 0x109266: main (cq-overflow.c:269)
  ==3054159==  Address 0x0 is not stack'd, malloc'd or (recently) free'd
  ==3054159==
  ==3054159==
  ==3054159== Process terminating with default action of signal 11 (SIGSEGV): dumping core
  ==3054159==  Access not within mapped region at address 0x0

Link: https://github.com/axboe/liburing/issues/640
Reported-by: Vitaly Chikunov <vt@altlinux.org>
Signed-off-by: Ammar Faizi <ammarfaizi2@gnuweeb.org>
Link: https://lore.kernel.org/r/20220810002735.2260172-2-ammar.faizi@intel.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>
diff --git a/test/cq-overflow.c b/test/cq-overflow.c
index 0018081..312b414 100644
--- a/test/cq-overflow.c
+++ b/test/cq-overflow.c
@@ -33,14 +33,15 @@
 	fd = open(file, O_RDONLY | O_DIRECT);
 	if (fd < 0) {
 		perror("file open");
-		goto err;
+		return 1;
 	}
 
 	memset(&p, 0, sizeof(p));
 	ret = io_uring_queue_init_params(ENTRIES, &ring, &p);
 	if (ret) {
+		close(fd);
 		fprintf(stderr, "ring create failed: %d\n", ret);
-		goto err;
+		return 1;
 	}
 	nodrop = 0;
 	if (p.features & IORING_FEAT_NODROP)