diff --git a/src/wrapper/slash_py.c b/src/wrapper/slash_py.c index da8c79d..be6b66c 100644 --- a/src/wrapper/slash_py.c +++ b/src/wrapper/slash_py.c @@ -1,5 +1,8 @@ #include "slash_py.h" #include +#include +#include +#include "../utils.h" #define PY_SSIZE_T_CLEAN #include @@ -26,5 +29,9 @@ PyObject * pycsh_slash_execute(PyObject * self, PyObject * args, PyObject * kwds char hist_buf[HISTORY_SIZE]; slash_create_static(&slas, line_buf, LINE_SIZE, hist_buf, HISTORY_SIZE); - return Py_BuildValue("i", slash_execute(&slas, command)); + char * cmd_cpy CLEANUP_FREE = strdup(command); + + PyObject * ret = Py_BuildValue("i", slash_execute(&slas, cmd_cpy)); + + return ret; }