lib530: simplify realloc failure exit path
To make code analyzers happier Closes #9392
This commit is contained in:
parent
56f1bbdd0c
commit
592290ed75
@ -92,14 +92,12 @@ static int addFd(struct Sockets *sockets, curl_socket_t fd, const char *what)
|
|||||||
sockets->max_count = 20;
|
sockets->max_count = 20;
|
||||||
}
|
}
|
||||||
else if(sockets->count + 1 > sockets->max_count) {
|
else if(sockets->count + 1 > sockets->max_count) {
|
||||||
curl_socket_t *oldptr = sockets->sockets;
|
curl_socket_t *ptr = realloc(sockets->sockets, sizeof(curl_socket_t) *
|
||||||
sockets->sockets = realloc(oldptr, sizeof(curl_socket_t) *
|
|
||||||
(sockets->max_count + 20));
|
(sockets->max_count + 20));
|
||||||
if(!sockets->sockets) {
|
if(!ptr)
|
||||||
/* cleanup in test_cleanup */
|
/* cleanup in test_cleanup */
|
||||||
sockets->sockets = oldptr;
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
sockets->sockets = ptr;
|
||||||
sockets->max_count += 20;
|
sockets->max_count += 20;
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
@ -361,7 +359,6 @@ test_cleanup:
|
|||||||
/* free local memory */
|
/* free local memory */
|
||||||
free(sockets.read.sockets);
|
free(sockets.read.sockets);
|
||||||
free(sockets.write.sockets);
|
free(sockets.write.sockets);
|
||||||
|
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user