Skip to content

Commit 6b7f9a6

Browse files
authored
Add a missing incref to c_headers_to_py (confluentinc#1165)
Before the `c_headers_to_py` function had a branch where a refcount was not correctly incremented. This can cause the `Py_None` object to eventually deallocate which will crash the interpreter.
1 parent bdd639c commit 6b7f9a6

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

src/confluent_kafka/src/confluent_kafka.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1299,6 +1299,7 @@ PyObject *c_headers_to_py (rd_kafka_headers_t *headers) {
12991299
cfl_PyBin(_FromStringAndSize(header_value, header_value_size))
13001300
);
13011301
} else {
1302+
Py_INCREF(Py_None);
13021303
PyTuple_SetItem(header_tuple, 1, Py_None);
13031304
}
13041305
PyList_SET_ITEM(header_list, idx-1, header_tuple);

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

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