Skip to content

Commit 38cb892

Browse files
committed
Fix memory leak in Python String reading
Fix Memory Leak in Python Array reading Use upload-artifacts-v4 Use download-artifacts-v4
1 parent f3d93d7 commit 38cb892

File tree

3 files changed

+18
-3
lines changed

3 files changed

+18
-3
lines changed

.github/workflows/build.yml

+12-2
Original file line numberDiff line numberDiff line change
@@ -194,8 +194,10 @@ jobs:
194194
195195
- name: 'Upload Artifacts - ${{ matrix.config.name }}'
196196
if: github.event_name == 'push'
197-
uses: actions/upload-artifact@v2.0.1
197+
uses: actions/upload-artifact@v4
198198
with:
199+
overwrite: true
200+
name: 'artifact-${{ matrix.config.name }}'
199201
path: '${{ github.workspace }}/cmake-build-release/${{ matrix.config.release }}'
200202

201203
Release:
@@ -242,7 +244,15 @@ jobs:
242244

243245
- name: Download Artifacts
244246
if: github.event_name == 'push'
245-
uses: actions/download-artifact@v2
247+
uses: actions/download-artifact@v4
248+
with:
249+
pattern: 'artifact-*'
250+
path: 'artifact'
251+
merge-multiple: true
252+
253+
- name: List Artifacts
254+
run: |
255+
ls artifact
246256
247257
- name: Upload Autobuild
248258
if: github.event_name == 'push' && !startsWith(github.ref, 'refs/tags/v')

RemoteInput/Injection/Injector_Darwin.cxx

+1-1
Original file line numberDiff line numberDiff line change
@@ -507,7 +507,7 @@ bool Injector::Inject(std::string module_path, std::int32_t pid, void* bootstrap
507507
//Retrieve a task port for the remote process..
508508
mach_port_t remote_task = 0;
509509
mach_error_t err = task_for_pid(mach_task_self(), pid, &remote_task);
510-
if (err == 5)
510+
if (err == KERN_FAILURE)
511511
{
512512
fprintf(stderr, "Could not access task for pid %d. You probably need to add user to procmod group\n", pid);
513513
return false;

RemoteInput/Plugin/Python/PythonCommon_Templates.hxx

+5
Original file line numberDiff line numberDiff line change
@@ -282,6 +282,7 @@ T from_python_object(PyObject* object)
282282
Py_ssize_t size = 0;
283283
char* buffer = nullptr;
284284
python->PyBytes_AsStringAndSize(utf8_string, &buffer, &size);
285+
(python->Py_XDECREF)(utf8_string);
285286
return *buffer;
286287
}
287288
return -1;
@@ -329,6 +330,7 @@ T from_python_object(PyObject* object)
329330
Py_ssize_t size = 0;
330331
char* buffer = nullptr;
331332
python->PyBytes_AsStringAndSize(utf8_string, &buffer, &size);
333+
(python->Py_XDECREF)(utf8_string);
332334
return std::string(buffer, size);
333335
}
334336
return std::string();
@@ -345,6 +347,7 @@ T from_python_object(PyObject* object)
345347
Py_ssize_t size = 0;
346348
char* buffer = nullptr;
347349
python->PyBytes_AsStringAndSize(utf8_string, &buffer, &size);
350+
(python->Py_XDECREF)(utf8_string);
348351
return buffer;
349352
}
350353
return nullptr;
@@ -425,6 +428,8 @@ std::vector<T> from_python_array(PyObject* object)
425428
result.push_back(from_python_object<T>(next));
426429
}
427430
}
431+
432+
(python->Py_DECREF)(iter);
428433
}
429434
return result;
430435
}

0 commit comments

Comments
 (0)