Selaa lähdekoodia

fix: close descriptor if failed to attach stream

David Marec 1 viikko sitten
vanhempi
sitoutus
520ae25c11
1 muutettua tiedostoa jossa 2 lisäystä ja 1 poistoa
  1. 2 1
      kqueue/kq_timer.c

+ 2 - 1
kqueue/kq_timer.c

@@ -103,7 +103,8 @@ int main(int argc, char *argv[])
 
 	fd = fdopen(fdx, "w");
 	if (fd == NULL) {
-		warn("fopen() failure");
+		warn("fdopen() failure");
+		close(fdx);
 		return EXIT_FAILURE;
 	}