diff options
author | Guido van Rossum <guido@python.org> | 1995-09-13 18:39:47 (GMT) |
---|---|---|
committer | Guido van Rossum <guido@python.org> | 1995-09-13 18:39:47 (GMT) |
commit | 7c53b7773377e917bb9650e51c4d475dd3b991e6 (patch) | |
tree | f86c70359e766da40ad2b78b0944d12801be739b /Modules/socketmodule.c | |
parent | 1c20648ba29657e1d3040871f4c3281a9c8c7ea4 (diff) | |
download | cpython-7c53b7773377e917bb9650e51c4d475dd3b991e6.zip cpython-7c53b7773377e917bb9650e51c4d475dd3b991e6.tar.gz cpython-7c53b7773377e917bb9650e51c4d475dd3b991e6.tar.bz2 |
plug some leaks
Diffstat (limited to 'Modules/socketmodule.c')
-rw-r--r-- | Modules/socketmodule.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/Modules/socketmodule.c b/Modules/socketmodule.c index 571a751..2987746 100644 --- a/Modules/socketmodule.c +++ b/Modules/socketmodule.c @@ -779,8 +779,10 @@ BUILD_FUNC_DEF_2(PySocketSock_recv,PySocketSockObject *,s, PyObject *,args) Py_BEGIN_ALLOW_THREADS n = recv(s->sock_fd, PyString_AsString(buf), len, flags); Py_END_ALLOW_THREADS - if (n < 0) + if (n < 0) { + Py_DECREF(buf); return PySocket_Err(); + } if (_PyString_Resize(&buf, n) < 0) return NULL; return buf; @@ -814,8 +816,10 @@ BUILD_FUNC_DEF_2(PySocketSock_recvfrom,PySocketSockObject *,s, PyObject *,args) (struct sockaddr *)addrbuf, &addrlen); #endif Py_END_ALLOW_THREADS - if (n < 0) + if (n < 0) { + Py_DECREF(buf); return PySocket_Err(); + } if (_PyString_Resize(&buf, n) < 0) return NULL; addr = makesockaddr((struct sockaddr *)addrbuf, addrlen); |