[Python-checkins] CVS: python/dist/src/Modules getaddrinfo.c,1.8,1.9 socketmodule.c,1.193,1.194
Martin v. L?wis
loewis@users.sourceforge.net
2001年11月07日 00:31:05 -0800
Update of /cvsroot/python/python/dist/src/Modules
In directory usw-pr-cvs1:/tmp/cvs-serv11992
Modified Files:
getaddrinfo.c socketmodule.c
Log Message:
Fix memory leaks detecting in bug report #478003.
Index: getaddrinfo.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Modules/getaddrinfo.c,v
retrieving revision 1.8
retrieving revision 1.9
diff -C2 -d -r1.8 -r1.9
*** getaddrinfo.c 2001年09月07日 16:10:00 1.8
--- getaddrinfo.c 2001年11月07日 08:31:03 1.9
***************
*** 572,581 ****
break;
}
! goto bad;
}
if ((hp->h_name == NULL) || (hp->h_name[0] == 0) ||
! (hp->h_addr_list[0] == NULL))
! ERR(EAI_FAIL);
for (i = 0; (ap = hp->h_addr_list[i]) != NULL; i++) {
--- 572,583 ----
break;
}
! goto free;
}
if ((hp->h_name == NULL) || (hp->h_name[0] == 0) ||
! (hp->h_addr_list[0] == NULL)) {
! error = EAI_FAIL;
! goto free;
! }
for (i = 0; (ap = hp->h_addr_list[i]) != NULL; i++) {
***************
*** 633,637 ****
freehostent(hp);
#endif
! bad:
*res = NULL;
return error;
--- 635,639 ----
freehostent(hp);
#endif
! /* bad: */
*res = NULL;
return error;
Index: socketmodule.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Modules/socketmodule.c,v
retrieving revision 1.193
retrieving revision 1.194
diff -C2 -d -r1.193 -r1.194
*** socketmodule.c 2001年11月05日 02:45:58 1.193
--- socketmodule.c 2001年11月07日 08:31:03 1.194
***************
*** 607,610 ****
--- 607,611 ----
}
if (res->ai_next) {
+ freeaddrinfo(res);
PyErr_SetString(PySocket_Error,
"wildcard resolved to multiple address");
***************
*** 2462,2466 ****
PySocket_getaddrinfo(PyObject *self, PyObject *args)
{
! struct addrinfo hints, *res0, *res;
PyObject *pobj = (PyObject *)NULL;
char pbuf[30];
--- 2463,2468 ----
PySocket_getaddrinfo(PyObject *self, PyObject *args)
{
! struct addrinfo hints, *res;
! struct addrinfo *res0 = NULL;
PyObject *pobj = (PyObject *)NULL;
char pbuf[30];
***************
*** 2523,2526 ****
--- 2525,2530 ----
Py_XDECREF(single);
Py_XDECREF(all);
+ if (res0)
+ freeaddrinfo(res0);
return (PyObject *)NULL;
}