mirror of
https://github.com/QingdaoU/Judger.git
synced 2024-12-28 16:01:41 +00:00
fixed reference count
This commit is contained in:
parent
2deba8dcca
commit
f31135d3a0
@ -40,7 +40,6 @@ static PyObject *judger_run(PyObject *self, PyObject *args, PyObject *kwargs) {
|
||||
}
|
||||
|
||||
if (!PyList_Check(args_list)) {
|
||||
// fixme decref
|
||||
RaiseValueError("args must be a list");
|
||||
}
|
||||
_config.args[count++] = _config.exe_path;
|
||||
@ -51,21 +50,21 @@ static PyObject *judger_run(PyObject *self, PyObject *args, PyObject *kwargs) {
|
||||
break;
|
||||
}
|
||||
if (!PyString_Check(next)) {
|
||||
// Py_DECREF(next);
|
||||
// free memory before the program exits.
|
||||
Py_DECREF(next);
|
||||
Py_DECREF(args_iter);
|
||||
RaiseValueError("arg item must be a string");
|
||||
}
|
||||
_config.args[count] = PyString_AsString(next);
|
||||
// Py_DECREF(next);
|
||||
Py_DECREF(next);
|
||||
count++;
|
||||
}
|
||||
_config.args[count] = NULL;
|
||||
// Py_DECREF(args_list);
|
||||
// Py_DECREF(args_iter);
|
||||
Py_DECREF(args_iter);
|
||||
|
||||
count = 0;
|
||||
|
||||
if (!PyList_Check(env_list)) {
|
||||
// fixme decref
|
||||
RaiseValueError("env must be a list");
|
||||
}
|
||||
env_iter = PyObject_GetIter(env_list);
|
||||
@ -75,28 +74,25 @@ static PyObject *judger_run(PyObject *self, PyObject *args, PyObject *kwargs) {
|
||||
break;
|
||||
}
|
||||
if (!PyString_Check(next)) {
|
||||
// Py_DECREF(next);
|
||||
Py_DECREF(next);
|
||||
Py_DECREF(env_iter);
|
||||
RaiseValueError("env item must be a string");
|
||||
}
|
||||
_config.env[count] = PyString_AsString(next);
|
||||
// Py_DECREF(next);
|
||||
count++;
|
||||
Py_DECREF(next);
|
||||
}
|
||||
_config.env[count] = NULL;
|
||||
// Py_DECREF(env_list);
|
||||
// Py_DECREF(env_iter);
|
||||
Py_DECREF(env_iter);
|
||||
|
||||
if (PyString_Check(rule_name)) {
|
||||
_config.seccomp_rule_name = PyString_AsString(rule_name);
|
||||
// Py_DECREF(rule_path);
|
||||
}
|
||||
else {
|
||||
if (rule_name == Py_None) {
|
||||
// Py_DECREF(rule_path);
|
||||
_config.seccomp_rule_name = NULL;
|
||||
}
|
||||
else {
|
||||
// fixme decref
|
||||
RaiseValueError("seccomp_rule_name must be string or None");
|
||||
}
|
||||
}
|
||||
@ -105,7 +101,6 @@ static PyObject *judger_run(PyObject *self, PyObject *args, PyObject *kwargs) {
|
||||
int (*judger_run)(struct config *, struct result *);
|
||||
|
||||
if (!handler) {
|
||||
// fixme decref
|
||||
RaiseValueError("dlopen error")
|
||||
}
|
||||
judger_run = dlsym(handler, "run");
|
||||
|
Loading…
Reference in New Issue
Block a user