aboutsummaryrefslogtreecommitdiff
path: root/tests/server
diff options
context:
space:
mode:
authorMarc Hoersken <info@marc-hoersken.de>2014-04-20 18:22:28 +0200
committerMarc Hoersken <info@marc-hoersken.de>2014-04-20 18:22:28 +0200
commiteb01947e1d9fa1aea35ab3383f1213502606431e (patch)
treea65785b9e977ffef77c8f96b832341d545f2050d /tests/server
parentee6791128fce28277671ea378104050cf130d2f2 (diff)
sockfilt.c: free memory in case of memory allocation errors
Diffstat (limited to 'tests/server')
-rw-r--r--tests/server/sockfilt.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/tests/server/sockfilt.c b/tests/server/sockfilt.c
index ae17e9c1e..a15baeb7f 100644
--- a/tests/server/sockfilt.c
+++ b/tests/server/sockfilt.c
@@ -562,6 +562,7 @@ static int select_ws(int nfds, fd_set *readfds, fd_set *writefds,
/* allocate internal array for the internal event handles */
handles = malloc(nfds * sizeof(HANDLE));
if(handles == NULL) {
+ free(fdarr);
errno = ENOMEM;
return -1;
}
@@ -569,6 +570,8 @@ static int select_ws(int nfds, fd_set *readfds, fd_set *writefds,
/* allocate internal array for the internal socket handles */
wsasocks = malloc(nfds * sizeof(curl_socket_t));
if(wsasocks == NULL) {
+ free(handles);
+ free(fdarr);
errno = ENOMEM;
return -1;
}
@@ -576,6 +579,9 @@ static int select_ws(int nfds, fd_set *readfds, fd_set *writefds,
/* allocate internal array for the internal WINSOCK2 events */
wsaevents = malloc(nfds * sizeof(WSAEVENT));
if(wsaevents == NULL) {
+ free(wsasocks);
+ free(handles);
+ free(fdarr);
errno = ENOMEM;
return -1;
}