[Python-checkins] CVS: python/dist/src/Modules socketmodule.c,1.191,1.192
Martin v. L?wis
loewis@users.sourceforge.net
2001年11月02日 15:34:54 -0800
Update of /cvsroot/python/python/dist/src/Modules
In directory usw-pr-cvs1:/tmp/cvs-serv12313/Modules
Modified Files:
socketmodule.c
Log Message:
Correct getnameinfo refcounting and tuple parsing. Fixes #476648.
Index: socketmodule.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Modules/socketmodule.c,v
retrieving revision 1.191
retrieving revision 1.192
diff -C2 -d -r1.191 -r1.192
*** socketmodule.c 2001年10月30日 01:26:49 1.191
--- socketmodule.c 2001年11月02日 23:34:52 1.192
***************
*** 2538,2542 ****
int flags;
char *hostp;
! int n, port, flowinfo, scope_id;
char hbuf[NI_MAXHOST], pbuf[NI_MAXSERV];
struct addrinfo hints, *res = NULL;
--- 2538,2542 ----
int flags;
char *hostp;
! int port, flowinfo, scope_id;
char hbuf[NI_MAXHOST], pbuf[NI_MAXSERV];
struct addrinfo hints, *res = NULL;
***************
*** 2545,2553 ****
flags = flowinfo = scope_id = 0;
! if (PyArg_ParseTuple(args, "Oi:getnameinfo", &sa, &flags) == 0)
return NULL;
! n = PyArg_ParseTuple(sa, "si|ii", &hostp, &port, &flowinfo, scope_id);
! if (n == 0)
! goto fail;
PyOS_snprintf(pbuf, sizeof(pbuf), "%d", port);
memset(&hints, 0, sizeof(hints));
--- 2545,2552 ----
flags = flowinfo = scope_id = 0;
! if (!PyArg_ParseTuple(args, "Oi:getnameinfo", &sa, &flags))
return NULL;
! if (!PyArg_ParseTuple(sa, "si|ii", &hostp, &port, &flowinfo, &scope_id))
! return NULL;
PyOS_snprintf(pbuf, sizeof(pbuf), "%d", port);
memset(&hints, 0, sizeof(hints));
***************
*** 2598,2602 ****
if (res)
freeaddrinfo(res);
- Py_XDECREF(sa);
return ret;
}
--- 2597,2600 ----