Mercurial > hg > orthanc-python
diff Sources/PythonLock.cpp @ 45:ee76cced46a5
Fix issue #185 (segfaults on non-UTF8 special characters in request URI)
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Mon, 03 Aug 2020 18:13:10 +0200 |
parents | fd58eb5749ed |
children | 23f3099bed47 |
line wrap: on
line diff
--- a/Sources/PythonLock.cpp Wed Jul 08 15:22:12 2020 +0200 +++ b/Sources/PythonLock.cpp Mon Aug 03 18:13:10 2020 +0200 @@ -21,6 +21,7 @@ #include "PythonFunction.h" #include "PythonModule.h" +#include "PythonString.h" #include "../Resources/Orthanc/Plugins/OrthancPluginCppWrapper.h" @@ -429,9 +430,8 @@ ORTHANC_PLUGINS_THROW_EXCEPTION(InternalError); } - PyObject* pyPath = PyUnicode_FromString(path.c_str()); - int result = PyList_Insert(sysPath, 0, pyPath); - Py_DECREF(pyPath); + PythonString pyPath(lock, path); + int result = PyList_Insert(sysPath, 0, pyPath.Release()); if (result != 0) {