File: src/python/pyhbac.c
Function: py_hbac_rule_validate
Error: returning (PyObject*)NULL without setting an exception
909 static PyObject *
910 py_hbac_rule_validate(HbacRuleObject *self, PyObject *args)
911 {
912     struct hbac_rule *rule;
913     bool is_valid;
914     uint32_t missing;
915     uint32_t attr;
916     PyObject *ret = NULL;
917     PyObject *py_is_valid = NULL;
918     PyObject *py_missing = NULL;
919     PyObject *py_attr = NULL;
920 
921     rule = HbacRule_to_native(self);
922     if (!rule) {
when treating unknown struct hbac_rule * from src/python/pyhbac.c:921 as non-NULL
taking False path
923         /* Make sure there is at least a generic exception */
924         if (!PyErr_Occurred()) {
925             PyErr_Format(PyExc_IOError,
926                          "Could not convert HbacRule to native type\n");
927         }
928         goto fail;
929     }
930 
931     is_valid = hbac_rule_is_complete(rule, &missing);
932     free_hbac_rule(rule);
933 
934     ret = PyTuple_New(2);
when PyTuple_New() succeeds
935     if (!ret) {
taking False path
936         PyErr_NoMemory();
937         goto fail;
938     }
939 
940     py_is_valid = PyBool_FromLong(is_valid);
PyBool_FromLong() returns
941     py_missing = sss_python_set_new();
when sss_python_set_new() succeeds
942     if (!py_missing || !py_is_valid) {
taking False path
943         PyErr_NoMemory();
944         goto fail;
945     }
946 
947     for (attr = HBAC_RULE_ELEMENT_USERS;
taking True path
948          attr <= HBAC_RULE_ELEMENT_SOURCEHOSTS;
949          attr <<= 1) {
950         if (!(missing & attr)) continue;
when considering range: 1 <= value <= 0xffffffff
taking False path
951 
952         py_attr = PyInt_FromLong(attr);
when PyInt_FromLong() succeeds
953         if (!py_attr) {
taking False path
954             PyErr_NoMemory();
955             goto fail;
956         }
957 
958         if (sss_python_set_add(py_missing, py_attr) != 0) {
when considering range: -0x80000000 <= value <= -1
taking True path
959             /* If the set-add succeeded, it would steal the reference */
960             Py_DECREF(py_attr);
when taking True path
961             goto fail;
962         }
963     }
964 
965     PyTuple_SET_ITEM(ret, 0, py_is_valid);
966     PyTuple_SET_ITEM(ret, 1, py_missing);
967     return ret;
968 
969 fail:
970     Py_XDECREF(ret);
taking False path
when taking True path
971     Py_XDECREF(py_missing);
taking False path
when taking True path
972     Py_XDECREF(py_is_valid);
taking False path
when taking True path
973     return NULL;
974 }
returning (PyObject*)NULL without setting an exception
found 15 similar trace(s) to this