Skip to content

Commit

Permalink
Fixed more possible memory leaks in windows versions of library.
Browse files Browse the repository at this point in the history
  • Loading branch information
haakonnessjoen committed May 7, 2014
1 parent 7bc5ee8 commit 92d0012
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions librouteros.c
Expand Up @@ -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;
}
Expand All @@ -358,6 +361,9 @@ struct ros_connection *ros_connect(char *address, int port) {
-1
#endif
) {
#ifdef _WIN32
WSACleanup();
#endif
free(conn);
return NULL;
}
Expand Down Expand Up @@ -385,6 +391,9 @@ int ros_disconnect(struct ros_connection *conn) {
conn->events = NULL;
}
free(conn);
#ifdef _WIN32
WSACleanup();
#endif

return result;
}
Expand Down

0 comments on commit 92d0012

Please sign in to comment.