Skip to content

Commit

Permalink
Fix segfault with describe_topics and flaky connection
Browse files Browse the repository at this point in the history
If you call describe_topics on a flaky connection, sometimes the
admin client reply has the host set to a null pointer. When this
occurs, instead of segfaulting, report the host as None.
  • Loading branch information
lpsinger committed Dec 15, 2023
1 parent bb4d013 commit c1c65e0
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions src/confluent_kafka/src/confluent_kafka.c
Original file line number Diff line number Diff line change
Expand Up @@ -2631,9 +2631,14 @@ PyObject *cfl_PyObject_lookup (const char *modulename, const char *typename) {


void cfl_PyDict_SetString (PyObject *dict, const char *name, const char *val) {
PyObject *vo = cfl_PyUnistr(_FromString(val));
PyDict_SetItemString(dict, name, vo);
Py_DECREF(vo);
if (val) {
PyObject *vo = cfl_PyUnistr(_FromString(val));
PyDict_SetItemString(dict, name, vo);
Py_DECREF(vo);
} else {
Py_INCREF(Py_None);
PyDict_SetItemString(dict, name, Py_None);
}
}

void cfl_PyDict_SetInt (PyObject *dict, const char *name, int val) {
Expand Down

0 comments on commit c1c65e0

Please sign in to comment.