mirror of
https://github.com/curl/curl.git
synced 2025-02-05 14:30:10 +08:00
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;
|
||||
}
|
||||
else if(sockets->count + 1 > sockets->max_count) {
|
||||
curl_socket_t *oldptr = sockets->sockets;
|
||||
sockets->sockets = realloc(oldptr, sizeof(curl_socket_t) *
|
||||
curl_socket_t *ptr = realloc(sockets->sockets, sizeof(curl_socket_t) *
|
||||
(sockets->max_count + 20));
|
||||
if(!sockets->sockets) {
|
||||
if(!ptr)
|
||||
/* cleanup in test_cleanup */
|
||||
sockets->sockets = oldptr;
|
||||
return 1;
|
||||
}
|
||||
sockets->sockets = ptr;
|
||||
sockets->max_count += 20;
|
||||
}
|
||||
/*
|
||||
@ -361,7 +359,6 @@ test_cleanup:
|
||||
/* free local memory */
|
||||
free(sockets.read.sockets);
|
||||
free(sockets.write.sockets);
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user