Permalink
Browse files

Fixed more possible memory leaks in windows versions of library.

  • Loading branch information...
haakonnessjoen committed May 7, 2014
1 parent 7bc5ee8 commit 92d001263254271a0547bc6e491a80e43bcb0170
Showing with 9 additions and 0 deletions.
  1. +9 −0 librouteros.c
View
@@ -342,6 +342,9 @@ struct ros_connection *ros_connect(char *address, int port) {
conn->socket = socket(AF_INET, SOCK_STREAM, 0);
if (conn->socket <= 0) {
+#ifdef _WIN32
+ WSACleanup();
+#endif
free(conn);
return NULL;
}
@@ -358,6 +361,9 @@ struct ros_connection *ros_connect(char *address, int port) {
-1
#endif
) {
+#ifdef _WIN32
+ WSACleanup();
+#endif
free(conn);
return NULL;
}
@@ -385,6 +391,9 @@ int ros_disconnect(struct ros_connection *conn) {
conn->events = NULL;
}
free(conn);
+#ifdef _WIN32
+ WSACleanup();
+#endif
return result;
}

0 comments on commit 92d0012

Please sign in to comment.