Don't set the error string twice We were setting it to "Invalid CPU" to then reset it to whatever was in errno. Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
diff --git a/python-schedutils/schedutils.c b/python-schedutils/schedutils.c index 206f5ab..dfc7cb5 100644 --- a/python-schedutils/schedutils.c +++ b/python-schedutils/schedutils.c
@@ -176,7 +176,8 @@ if (cpu >= max_cpus) { PyErr_SetString(PyExc_OSError, "Invalid CPU"); - goto out_free; + CPU_FREE(cpus); + return NULL; } CPU_SET_S(cpu, cpusetsize, cpus); } @@ -189,8 +190,6 @@ out: Py_INCREF(Py_None); return Py_None; -out_free: - CPU_FREE(cpus); out_error: PyErr_SetFromErrno(PyExc_OSError); goto out;