mirror of
https://github.com/python/cpython.git
synced 2025-09-26 18:29:57 +00:00
Fix refleak in socketmodule. Replace bogus Py_BuildValue calls.
Fix refleak in exceptions.
This commit is contained in:
parent
964f5978dc
commit
c7c51147c7
2 changed files with 6 additions and 3 deletions
|
@ -2472,7 +2472,7 @@ sock_recvfrom_buf(PySocketSockObject *s, PyObject *args, PyObject* kwds)
|
||||||
|
|
||||||
/* Return the number of bytes read and the address. Note that we do
|
/* Return the number of bytes read and the address. Note that we do
|
||||||
not do anything special here in the case that readlen < recvlen. */
|
not do anything special here in the case that readlen < recvlen. */
|
||||||
ret = PyTuple_Pack(2, PyInt_FromLong(readlen), addr);
|
ret = Py_BuildValue("lO", readlen, addr);
|
||||||
|
|
||||||
finally:
|
finally:
|
||||||
Py_XDECREF(addr);
|
Py_XDECREF(addr);
|
||||||
|
@ -4364,8 +4364,10 @@ init_socket(void)
|
||||||
PyModule_AddIntConstant(m, "BTPROTO_SCO", BTPROTO_SCO);
|
PyModule_AddIntConstant(m, "BTPROTO_SCO", BTPROTO_SCO);
|
||||||
#endif
|
#endif
|
||||||
PyModule_AddIntConstant(m, "BTPROTO_RFCOMM", BTPROTO_RFCOMM);
|
PyModule_AddIntConstant(m, "BTPROTO_RFCOMM", BTPROTO_RFCOMM);
|
||||||
PyModule_AddObject(m, "BDADDR_ANY", Py_BuildValue("s", "00:00:00:00:00:00"));
|
PyModule_AddObject(m, "BDADDR_ANY",
|
||||||
PyModule_AddObject(m, "BDADDR_LOCAL", Py_BuildValue("s", "00:00:00:FF:FF:FF"));
|
PyString_FromString("00:00:00:00:00:00"));
|
||||||
|
PyModule_AddObject(m, "BDADDR_LOCAL",
|
||||||
|
PyString_FromString("00:00:00:FF:FF:FF"));
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef HAVE_NETPACKET_PACKET_H
|
#ifdef HAVE_NETPACKET_PACKET_H
|
||||||
|
|
|
@ -246,6 +246,7 @@ BaseException_set_args(PyBaseExceptionObject *self, PyObject *val)
|
||||||
}
|
}
|
||||||
seq = PySequence_Tuple(val);
|
seq = PySequence_Tuple(val);
|
||||||
if (!seq) return -1;
|
if (!seq) return -1;
|
||||||
|
Py_CLEAR(self->args);
|
||||||
self->args = seq;
|
self->args = seq;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue