changeset 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 262189b417cd
children a862d554753f
files Sources/DicomScpCallbacks.cpp Sources/IncomingHttpRequestFilter.cpp Sources/RestCallbacks.cpp
diffstat 3 files changed, 20 insertions(+), 20 deletions(-) [+]
line wrap: on
line diff
--- a/Sources/DicomScpCallbacks.cpp	Wed Aug 30 10:24:46 2023 +0200
+++ b/Sources/DicomScpCallbacks.cpp	Wed Aug 30 10:32:26 2023 +0200
@@ -295,47 +295,47 @@
 
       {
         PythonString tmp(lock, level);
-        PyDict_SetItemString(kw.GetPyObject(), "Level", tmp.Release());
+        PyDict_SetItemString(kw.GetPyObject(), "Level", tmp.GetPyObject());
       }
 
       {
         PythonString tmp(lock, patientId_);
-        PyDict_SetItemString(kw.GetPyObject(), "PatientID", tmp.Release());
+        PyDict_SetItemString(kw.GetPyObject(), "PatientID", tmp.GetPyObject());
       }
 
       {
         PythonString tmp(lock, accessionNumber_);
-        PyDict_SetItemString(kw.GetPyObject(), "AccessionNumber", tmp.Release());
+        PyDict_SetItemString(kw.GetPyObject(), "AccessionNumber", tmp.GetPyObject());
       }
 
       {
         PythonString tmp(lock, studyInstanceUid_);
-        PyDict_SetItemString(kw.GetPyObject(), "StudyInstanceUID", tmp.Release());
+        PyDict_SetItemString(kw.GetPyObject(), "StudyInstanceUID", tmp.GetPyObject());
       }
 
       {
         PythonString tmp(lock, seriesInstanceUid_);
-        PyDict_SetItemString(kw.GetPyObject(), "SeriesInstanceUID", tmp.Release());
+        PyDict_SetItemString(kw.GetPyObject(), "SeriesInstanceUID", tmp.GetPyObject());
       }
 
       {
         PythonString tmp(lock, sopInstanceUid_);
-        PyDict_SetItemString(kw.GetPyObject(), "SOPInstanceUID", tmp.Release());
+        PyDict_SetItemString(kw.GetPyObject(), "SOPInstanceUID", tmp.GetPyObject());
       }
 
       {
         PythonString tmp(lock, originatorAet_);
-        PyDict_SetItemString(kw.GetPyObject(), "OriginatorAET", tmp.Release());
+        PyDict_SetItemString(kw.GetPyObject(), "OriginatorAET", tmp.GetPyObject());
       }
 
       {
         PythonString tmp(lock, sourceAet_);
-        PyDict_SetItemString(kw.GetPyObject(), "SourceAET", tmp.Release());
+        PyDict_SetItemString(kw.GetPyObject(), "SourceAET", tmp.GetPyObject());
       }
 
       {
         PythonString tmp(lock, targetAet_);
-        PyDict_SetItemString(kw.GetPyObject(), "TargetAET", tmp.Release());
+        PyDict_SetItemString(kw.GetPyObject(), "TargetAET", tmp.GetPyObject());
       }
 
       PyDict_SetItemString(kw.GetPyObject(), "OriginatorID", PyLong_FromUnsignedLong(originatorId_));
--- a/Sources/IncomingHttpRequestFilter.cpp	Wed Aug 30 10:24:46 2023 +0200
+++ b/Sources/IncomingHttpRequestFilter.cpp	Wed Aug 30 10:32:26 2023 +0200
@@ -55,7 +55,7 @@
 
     {
       PythonString str(lock, ip);
-      PyDict_SetItemString(kw.GetPyObject(), "ip", str.Release());
+      PyDict_SetItemString(kw.GetPyObject(), "ip", str.GetPyObject());
     }
 
     {
@@ -64,10 +64,10 @@
       for (uint32_t i = 0; i < headersCount; i++)
       {
         PythonString str(lock, headersValues[i]);
-        PyDict_SetItemString(headers.GetPyObject(), headersKeys[i], str.Release());
+        PyDict_SetItemString(headers.GetPyObject(), headersKeys[i], str.GetPyObject());
       }
 
-      PyDict_SetItemString(kw.GetPyObject(), "headers", headers.Release());
+      PyDict_SetItemString(kw.GetPyObject(), "headers", headers.GetPyObject());
     }
 
     if (method == OrthancPluginHttpMethod_Get)
@@ -77,10 +77,10 @@
       for (uint32_t i = 0; i < getArgumentsCount; i++)
       {
         PythonString str(lock, getArgumentsValues[i]);
-        PyDict_SetItemString(getArguments.GetPyObject(), getArgumentsKeys[i], str.Release());
+        PyDict_SetItemString(getArguments.GetPyObject(), getArgumentsKeys[i], str.GetPyObject());
       }
 
-      PyDict_SetItemString(kw.GetPyObject(), "get", getArguments.Release());
+      PyDict_SetItemString(kw.GetPyObject(), "get", getArguments.GetPyObject());
     }
     
     PythonObject result(lock, PyObject_Call(incomingHttpRequestFilter_,
--- a/Sources/RestCallbacks.cpp	Wed Aug 30 10:24:46 2023 +0200
+++ b/Sources/RestCallbacks.cpp	Wed Aug 30 10:32:26 2023 +0200
@@ -128,7 +128,7 @@
 
       {
         PythonString tmp(lock, method);
-        PyDict_SetItemString(kw.GetPyObject(), "method", tmp.Release());
+        PyDict_SetItemString(kw.GetPyObject(), "method", tmp.GetPyObject());
       }
 
       {
@@ -140,7 +140,7 @@
           PyTuple_SetItem(groups.GetPyObject(), i, tmp.Release());
         }
 
-        PyDict_SetItemString(kw.GetPyObject(), "groups", groups.Release());
+        PyDict_SetItemString(kw.GetPyObject(), "groups", groups.GetPyObject());
       }
 
       if (request->method == OrthancPluginHttpMethod_Get)
@@ -150,10 +150,10 @@
         for (uint32_t i = 0; i < request->getCount; i++)
         {
           PythonString value(lock, request->getValues[i]);
-          PyDict_SetItemString(get.GetPyObject(), request->getKeys[i], value.Release());
+          PyDict_SetItemString(get.GetPyObject(), request->getKeys[i], value.GetPyObject());
         }
 
-        PyDict_SetItemString(kw.GetPyObject(), "get", get.Release());
+        PyDict_SetItemString(kw.GetPyObject(), "get", get.GetPyObject());
       }
 
       {
@@ -162,10 +162,10 @@
         for (uint32_t i = 0; i < request->headersCount; i++)
         {
           PythonString value(lock, request->headersValues[i]);
-          PyDict_SetItemString(headers.GetPyObject(), request->headersKeys[i], value.Release());
+          PyDict_SetItemString(headers.GetPyObject(), request->headersKeys[i], value.GetPyObject());
         }
 
-        PyDict_SetItemString(kw.GetPyObject(), "headers", headers.Release());
+        PyDict_SetItemString(kw.GetPyObject(), "headers", headers.GetPyObject());
       }
 
       if (request->method == OrthancPluginHttpMethod_Post ||