Skip to content

Commit 1353b41

Browse files
Prerak SinghPrerak Singh
authored andcommitted
bug fix
1 parent 3c185c5 commit 1353b41

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

pydatastructs/linear_data_structures/_backend/cpp/algorithms/quadratic_time_sort.hpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -244,9 +244,15 @@ static PyObject* bubble_sort_llvm(PyObject* self, PyObject* args, PyObject* kwds
244244
PyErr_Clear();
245245
}
246246
Py_DECREF(sys_path);
247+
if (!mod) {
248+
return NULL;
249+
}
247250

248251
PyObject* fn = PyObject_GetAttrString(mod, "get_bubble_sort_ptr");
249252
Py_DECREF(mod);
253+
if (!fn) {
254+
return NULL;
255+
}
250256

251257
PyObject* arg = PyUnicode_FromString(dtype_str);
252258
if (!arg) {
@@ -257,6 +263,9 @@ static PyObject* bubble_sort_llvm(PyObject* self, PyObject* args, PyObject* kwds
257263
PyObject* addr_obj = PyObject_CallFunctionObjArgs(fn, arg, NULL);
258264
Py_DECREF(fn);
259265
Py_DECREF(arg);
266+
if (!addr_obj) {
267+
return NULL;
268+
}
260269
return addr_obj;
261270
};
262271

0 commit comments

Comments
 (0)