mirror of
https://github.com/python/cpython.git
synced 2025-08-31 05:58:33 +00:00
plug some leaks
This commit is contained in:
parent
1c20648ba2
commit
7c53b77733
1 changed files with 6 additions and 2 deletions
|
@ -779,8 +779,10 @@ BUILD_FUNC_DEF_2(PySocketSock_recv,PySocketSockObject *,s, PyObject *,args)
|
||||||
Py_BEGIN_ALLOW_THREADS
|
Py_BEGIN_ALLOW_THREADS
|
||||||
n = recv(s->sock_fd, PyString_AsString(buf), len, flags);
|
n = recv(s->sock_fd, PyString_AsString(buf), len, flags);
|
||||||
Py_END_ALLOW_THREADS
|
Py_END_ALLOW_THREADS
|
||||||
if (n < 0)
|
if (n < 0) {
|
||||||
|
Py_DECREF(buf);
|
||||||
return PySocket_Err();
|
return PySocket_Err();
|
||||||
|
}
|
||||||
if (_PyString_Resize(&buf, n) < 0)
|
if (_PyString_Resize(&buf, n) < 0)
|
||||||
return NULL;
|
return NULL;
|
||||||
return buf;
|
return buf;
|
||||||
|
@ -814,8 +816,10 @@ BUILD_FUNC_DEF_2(PySocketSock_recvfrom,PySocketSockObject *,s, PyObject *,args)
|
||||||
(struct sockaddr *)addrbuf, &addrlen);
|
(struct sockaddr *)addrbuf, &addrlen);
|
||||||
#endif
|
#endif
|
||||||
Py_END_ALLOW_THREADS
|
Py_END_ALLOW_THREADS
|
||||||
if (n < 0)
|
if (n < 0) {
|
||||||
|
Py_DECREF(buf);
|
||||||
return PySocket_Err();
|
return PySocket_Err();
|
||||||
|
}
|
||||||
if (_PyString_Resize(&buf, n) < 0)
|
if (_PyString_Resize(&buf, n) < 0)
|
||||||
return NULL;
|
return NULL;
|
||||||
addr = makesockaddr((struct sockaddr *)addrbuf, addrlen);
|
addr = makesockaddr((struct sockaddr *)addrbuf, addrlen);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue