Fri Mar 7 12:31:52 EST 2008 Pekka.Pessi@nokia.com
* sres_blocking.c: validating calloc() return value git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@7828 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
parent
2abc13f368
commit
875c0851d0
|
@ -113,6 +113,9 @@ int sres_blocking_update(sres_blocking_t *b,
|
||||||
{
|
{
|
||||||
int i, N = b->n_sockets;
|
int i, N = b->n_sockets;
|
||||||
|
|
||||||
|
if (b == NULL)
|
||||||
|
return -1;
|
||||||
|
|
||||||
if (old_socket == new_socket) {
|
if (old_socket == new_socket) {
|
||||||
if (old_socket == INVALID_SOCKET) {
|
if (old_socket == INVALID_SOCKET) {
|
||||||
free(b); /* Destroy us */
|
free(b); /* Destroy us */
|
||||||
|
@ -233,11 +236,13 @@ sres_blocking_t *sres_set_blocking(sres_resolver_t *res)
|
||||||
/* Create a synchronous (blocking) interface towards resolver */
|
/* Create a synchronous (blocking) interface towards resolver */
|
||||||
b = calloc(1, sizeof *b);
|
b = calloc(1, sizeof *b);
|
||||||
|
|
||||||
for (i = 0; i < SRES_MAX_NAMESERVERS; i++)
|
if (b) {
|
||||||
b->fds[i].fd = INVALID_SOCKET;
|
for (i = 0; i < SRES_MAX_NAMESERVERS; i++)
|
||||||
|
b->fds[i].fd = INVALID_SOCKET;
|
||||||
|
|
||||||
if (!sres_resolver_set_async(res, sres_blocking_update, b, 0)) {
|
if (!sres_resolver_set_async(res, sres_blocking_update, b, 0)) {
|
||||||
free(b), b = NULL;
|
free(b), b = NULL;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return b;
|
return b;
|
||||||
|
|
Loading…
Reference in New Issue