Mercurial > hg > orthanc-python
comparison Sources/IncomingHttpRequestFilter.cpp @ 126:9ffe8881f856 fix-leak
fixing more PyDict_SetItemString()
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Wed, 30 Aug 2023 10:32:26 +0200 |
parents | eb6ac5a801d1 |
children | a862d554753f |
comparison
equal
deleted
inserted
replaced
125:262189b417cd | 126:9ffe8881f856 |
---|---|
53 PythonObject kw(lock, PyDict_New()); | 53 PythonObject kw(lock, PyDict_New()); |
54 PyDict_SetItemString(kw.GetPyObject(), "method", PyLong_FromLong(method)); | 54 PyDict_SetItemString(kw.GetPyObject(), "method", PyLong_FromLong(method)); |
55 | 55 |
56 { | 56 { |
57 PythonString str(lock, ip); | 57 PythonString str(lock, ip); |
58 PyDict_SetItemString(kw.GetPyObject(), "ip", str.Release()); | 58 PyDict_SetItemString(kw.GetPyObject(), "ip", str.GetPyObject()); |
59 } | 59 } |
60 | 60 |
61 { | 61 { |
62 PythonObject headers(lock, PyDict_New()); | 62 PythonObject headers(lock, PyDict_New()); |
63 | 63 |
64 for (uint32_t i = 0; i < headersCount; i++) | 64 for (uint32_t i = 0; i < headersCount; i++) |
65 { | 65 { |
66 PythonString str(lock, headersValues[i]); | 66 PythonString str(lock, headersValues[i]); |
67 PyDict_SetItemString(headers.GetPyObject(), headersKeys[i], str.Release()); | 67 PyDict_SetItemString(headers.GetPyObject(), headersKeys[i], str.GetPyObject()); |
68 } | 68 } |
69 | 69 |
70 PyDict_SetItemString(kw.GetPyObject(), "headers", headers.Release()); | 70 PyDict_SetItemString(kw.GetPyObject(), "headers", headers.GetPyObject()); |
71 } | 71 } |
72 | 72 |
73 if (method == OrthancPluginHttpMethod_Get) | 73 if (method == OrthancPluginHttpMethod_Get) |
74 { | 74 { |
75 PythonObject getArguments(lock, PyDict_New()); | 75 PythonObject getArguments(lock, PyDict_New()); |
76 | 76 |
77 for (uint32_t i = 0; i < getArgumentsCount; i++) | 77 for (uint32_t i = 0; i < getArgumentsCount; i++) |
78 { | 78 { |
79 PythonString str(lock, getArgumentsValues[i]); | 79 PythonString str(lock, getArgumentsValues[i]); |
80 PyDict_SetItemString(getArguments.GetPyObject(), getArgumentsKeys[i], str.Release()); | 80 PyDict_SetItemString(getArguments.GetPyObject(), getArgumentsKeys[i], str.GetPyObject()); |
81 } | 81 } |
82 | 82 |
83 PyDict_SetItemString(kw.GetPyObject(), "get", getArguments.Release()); | 83 PyDict_SetItemString(kw.GetPyObject(), "get", getArguments.GetPyObject()); |
84 } | 84 } |
85 | 85 |
86 PythonObject result(lock, PyObject_Call(incomingHttpRequestFilter_, | 86 PythonObject result(lock, PyObject_Call(incomingHttpRequestFilter_, |
87 args.GetPyObject(), kw.GetPyObject())); | 87 args.GetPyObject(), kw.GetPyObject())); |
88 | 88 |