Fixed fd leak in test code.
authorThomas Pornin <pornin@bolet.org>
Thu, 3 Jan 2019 13:31:38 +0000 (14:31 +0100)
committerThomas Pornin <pornin@bolet.org>
Thu, 3 Jan 2019 13:31:38 +0000 (14:31 +0100)
src/rand/sysrng.c
tools/server.c

index bec06be..5ddbcbe 100644 (file)
@@ -161,9 +161,10 @@ br_prng_seeder_system(const char **name)
                *name = "win32";
        }
        return &seeder_win32;
-#endif
+#else
        if (name != NULL) {
                *name = "none";
        }
        return 0;
+#endif
 }
index 9d296d2..a97de35 100644 (file)
@@ -1220,6 +1220,13 @@ server_exit:
                close(fd);
 #endif
        }
+       if (server_fd != INVALID_SOCKET) {
+#ifdef _WIN32
+               closesocket(server_fd);
+#else
+               close(server_fd);
+#endif
+       }
        return retcode;
 
 server_exit_error: