pFad - Phone/Frame/Anonymizer/Declutterfier! Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

URL: http://github.com/python/cpython/commit/d77d97c9a1f593fe161afab97e2a3e2292ab88b9

bpo-35529: Fix a reference counting bug in PyCFuncPtr_FromDll(). (GH-… · python/cpython@d77d97c · GitHub
Skip to content

Commit d77d97c

Browse files
ZackerySpytzserhiy-storchaka
authored andcommitted
bpo-35529: Fix a reference counting bug in PyCFuncPtr_FromDll(). (GH-11229)
"dll" would leak if an error occurred in _validate_paramflags() or GenericPyCData_new().
1 parent b13a20f commit d77d97c

1 file changed

Lines changed: 8 additions & 5 deletions

File tree

Modules/_ctypes/_ctypes.c

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3483,20 +3483,23 @@ PyCFuncPtr_FromDll(PyTypeObject *type, PyObject *args, PyObject *kwds)
34833483
return NULL;
34843484
}
34853485
#endif
3486-
Py_INCREF(dll); /* for KeepRef */
3487-
Py_DECREF(ftuple);
3488-
if (!_validate_paramflags(type, paramflags))
3486+
if (!_validate_paramflags(type, paramflags)) {
3487+
Py_DECREF(ftuple);
34893488
return NULL;
3489+
}
34903490

34913491
self = (PyCFuncPtrObject *)GenericPyCData_new(type, args, kwds);
3492-
if (!self)
3492+
if (!self) {
3493+
Py_DECREF(ftuple);
34933494
return NULL;
3495+
}
34943496

34953497
Py_XINCREF(paramflags);
34963498
self->paramflags = paramflags;
34973499

34983500
*(void **)self->b_ptr = address;
3499-
3501+
Py_INCREF(dll);
3502+
Py_DECREF(ftuple);
35003503
if (-1 == KeepRef((CDataObject *)self, 0, dll)) {
35013504
Py_DECREF((PyObject *)self);
35023505
return NULL;

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad © 2024 Your Company Name. All rights reserved.





Check this box to remove all script contents from the fetched content.



Check this box to remove all images from the fetched content.


Check this box to remove all CSS styles from the fetched content.


Check this box to keep images inefficiently compressed and original size.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy