summaryrefslogtreecommitdiffstats
path: root/Modules/socketmodule.c
diff options
context:
space:
mode:
authorMartin v. Löwis <martin@v.loewis.de>2001-11-07 08:31:03 (GMT)
committerMartin v. Löwis <martin@v.loewis.de>2001-11-07 08:31:03 (GMT)
commitf0b11d28937c826054f662b4958d3d637bf42fd0 (patch)
treed4092f2bbe7b9e7459e28113183fe29fa826ab1b /Modules/socketmodule.c
parent0b663104760b6d32bb6dfb49ef45194de6c05a66 (diff)
downloadcpython-f0b11d28937c826054f662b4958d3d637bf42fd0.zip
cpython-f0b11d28937c826054f662b4958d3d637bf42fd0.tar.gz
cpython-f0b11d28937c826054f662b4958d3d637bf42fd0.tar.bz2
Fix memory leaks detecting in bug report #478003.
Diffstat (limited to 'Modules/socketmodule.c')
-rw-r--r--Modules/socketmodule.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/Modules/socketmodule.c b/Modules/socketmodule.c
index fea6b85..601880e 100644
--- a/Modules/socketmodule.c
+++ b/Modules/socketmodule.c
@@ -606,6 +606,7 @@ setipaddr(char* name, struct sockaddr * addr_ret, int af)
return -1;
}
if (res->ai_next) {
+ freeaddrinfo(res);
PyErr_SetString(PySocket_Error,
"wildcard resolved to multiple address");
return -1;
@@ -2461,7 +2462,8 @@ PySocket_inet_ntoa(PyObject *self, PyObject *args)
static PyObject *
PySocket_getaddrinfo(PyObject *self, PyObject *args)
{
- struct addrinfo hints, *res0, *res;
+ struct addrinfo hints, *res;
+ struct addrinfo *res0 = NULL;
PyObject *pobj = (PyObject *)NULL;
char pbuf[30];
char *hptr, *pptr;
@@ -2522,6 +2524,8 @@ PySocket_getaddrinfo(PyObject *self, PyObject *args)
err:
Py_XDECREF(single);
Py_XDECREF(all);
+ if (res0)
+ freeaddrinfo(res0);
return (PyObject *)NULL;
}