[Freeswitch-svn] [commit] r7828 - freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/sresolv
Freeswitch SVN
mikej at freeswitch.org
Fri Mar 7 12:52:20 EST 2008
Author: mikej
Date: Fri Mar 7 12:52:20 2008
New Revision: 7828
Modified:
freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/sresolv/sres_blocking.c
Log:
Fri Mar 7 12:31:52 EST 2008 Pekka.Pessi at nokia.com
* sres_blocking.c: validating calloc() return value
Modified: freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/sresolv/sres_blocking.c
==============================================================================
--- freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/sresolv/sres_blocking.c (original)
+++ freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/sresolv/sres_blocking.c Fri Mar 7 12:52:20 2008
@@ -113,6 +113,9 @@
{
int i, N = b->n_sockets;
+ if (b == NULL)
+ return -1;
+
if (old_socket == new_socket) {
if (old_socket == INVALID_SOCKET) {
free(b); /* Destroy us */
@@ -233,11 +236,13 @@
/* Create a synchronous (blocking) interface towards resolver */
b = calloc(1, sizeof *b);
- for (i = 0; i < SRES_MAX_NAMESERVERS; i++)
- b->fds[i].fd = INVALID_SOCKET;
+ if (b) {
+ 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)) {
- free(b), b = NULL;
+ if (!sres_resolver_set_async(res, sres_blocking_update, b, 0)) {
+ free(b), b = NULL;
+ }
}
return b;
More information about the Freeswitch-svn
mailing list