File: | Modules/ldapcontrol.c |
Function: | encode_rfc2696 |
Error: | ob_refcnt of new ref from (unknown) LDAPerr is 1 too high |
242 static PyObject*
243 encode_rfc2696(PyObject *self, PyObject *args)
244 {
245 PyObject *res = 0;
246 BerElement *ber = 0;
247 struct berval cookie, *ctrl_val;
248 Py_ssize_t cookie_len;
249 unsigned long size;
250 ber_tag_t tag;
251
252 if (!PyArg_ParseTuple(args, "is#:encode_page_control", &size,
when _PyArg_ParseTuple_SizeT() succeeds
taking False path
253 &cookie.bv_val, &cookie_len)) {
254 goto endlbl;
255 }
256 cookie.bv_len = (ber_len_t) cookie_len;
257
258 if (!(ber = ber_alloc_t(LBER_USE_DER))) {
when treating unknown struct BerElement * from Modules/ldapcontrol.c:258 as non-NULL
taking False path
259 LDAPerr(LDAP_NO_MEMORY);
260 goto endlbl;
261 }
262
263 tag = ber_printf(ber, "{i", size);
264 if (tag == LBER_ERROR) {
taking False path
265 LDAPerr(LDAP_ENCODING_ERROR);
266 goto endlbl;
267 }
268
269 if (!cookie.bv_len)
when considering range: -0x8000000000000000 <= value <= -1
taking False path
270 tag = ber_printf(ber, "o", "", 0);
271 else
272 tag = ber_printf(ber, "O", &cookie);
273 if (tag == LBER_ERROR) {
taking False path
274 LDAPerr(LDAP_ENCODING_ERROR);
275 goto endlbl;
276 }
277
278 tag = ber_printf(ber, /*{ */ "N}");
279 if (tag == LBER_ERROR) {
taking False path
280 LDAPerr(LDAP_ENCODING_ERROR);
281 goto endlbl;
282 }
283
284 if (-1 == ber_flatten(ber, &ctrl_val)) {
when considering value == (int)-1 from Modules/ldapcontrol.c:284
taking True path
285 LDAPerr(LDAP_NO_MEMORY);
when LDAPerr() succeeds
new ref from (unknown) LDAPerr allocated at: LDAPerr(LDAP_NO_MEMORY);
ob_refcnt is now refs: 1 + N where N >= 0
286 goto endlbl;
287 }
288
289 res = LDAPberval_to_object(ctrl_val);
290
291 endlbl:
292 if (ber)
taking True path
293 ber_free(ber, 1);
294 return res;
returning
ob_refcnt of new ref from (unknown) LDAPerr is 1 too high
was expecting final ob_refcnt to be N + 0 (for some unknown N)
but final ob_refcnt is N + 1
found 3 similar trace(s) to this
295 }
File: | Modules/ldapcontrol.c |
Function: | encode_rfc2696 |
Error: | returning (PyObject*)NULL without setting an exception |
242 static PyObject*
243 encode_rfc2696(PyObject *self, PyObject *args)
244 {
245 PyObject *res = 0;
246 BerElement *ber = 0;
247 struct berval cookie, *ctrl_val;
248 Py_ssize_t cookie_len;
249 unsigned long size;
250 ber_tag_t tag;
251
252 if (!PyArg_ParseTuple(args, "is#:encode_page_control", &size,
when _PyArg_ParseTuple_SizeT() succeeds
taking False path
253 &cookie.bv_val, &cookie_len)) {
254 goto endlbl;
255 }
256 cookie.bv_len = (ber_len_t) cookie_len;
257
258 if (!(ber = ber_alloc_t(LBER_USE_DER))) {
when treating unknown struct BerElement * from Modules/ldapcontrol.c:258 as non-NULL
taking False path
259 LDAPerr(LDAP_NO_MEMORY);
260 goto endlbl;
261 }
262
263 tag = ber_printf(ber, "{i", size);
264 if (tag == LBER_ERROR) {
taking False path
265 LDAPerr(LDAP_ENCODING_ERROR);
266 goto endlbl;
267 }
268
269 if (!cookie.bv_len)
when considering range: -0x8000000000000000 <= value <= -1
taking False path
270 tag = ber_printf(ber, "o", "", 0);
271 else
272 tag = ber_printf(ber, "O", &cookie);
273 if (tag == LBER_ERROR) {
taking False path
274 LDAPerr(LDAP_ENCODING_ERROR);
275 goto endlbl;
276 }
277
278 tag = ber_printf(ber, /*{ */ "N}");
279 if (tag == LBER_ERROR) {
taking False path
280 LDAPerr(LDAP_ENCODING_ERROR);
281 goto endlbl;
282 }
283
284 if (-1 == ber_flatten(ber, &ctrl_val)) {
when considering value == (int)-1 from Modules/ldapcontrol.c:284
taking True path
285 LDAPerr(LDAP_NO_MEMORY);
when LDAPerr() succeeds
286 goto endlbl;
287 }
288
289 res = LDAPberval_to_object(ctrl_val);
290
291 endlbl:
292 if (ber)
taking True path
293 ber_free(ber, 1);
294 return res;
returning
returning (PyObject*)NULL without setting an exception
found 3 similar trace(s) to this
295 }