diff options
author | Daniel Alley <dalley@redhat.com> | 2021-11-18 23:45:49 +0300 |
---|---|---|
committer | amatej <matej.ales@seznam.cz> | 2021-11-25 14:31:24 +0300 |
commit | 58e3bdee62aed3d110d8af170e70147208142bc9 (patch) | |
tree | 05394b5f92cb1abcb8ae75324270917d16a870a4 | |
parent | 7a806f58d2737a17b1234dcbc8715cb3ae02edaa (diff) |
Fix lifetime issues
closes #293
-rw-r--r-- | src/package.c | 5 | ||||
-rw-r--r-- | src/python/xml_parser-py.c | 5 |
2 files changed, 4 insertions, 6 deletions
diff --git a/src/package.c b/src/package.c index 223e271..0b14cf7 100644 --- a/src/package.c +++ b/src/package.c @@ -87,11 +87,6 @@ cr_package_free(cr_Package *package) if (package->chunk && !(package->loadingflags & CR_PACKAGE_SINGLE_CHUNK)) g_string_chunk_free (package->chunk); -/* Note: Since glib 2.28 - * g_slist_foreach && g_slist_free could be replaced with one function: - * g_slist_free_full() - */ - if (package->requires) { g_slist_free_full(package->requires, g_free); } diff --git a/src/python/xml_parser-py.c b/src/python/xml_parser-py.c index a1f92f8..9d3d5a5 100644 --- a/src/python/xml_parser-py.c +++ b/src/python/xml_parser-py.c @@ -77,8 +77,10 @@ c_newpkgcb(cr_Package **pkg, } } + if (result->ob_refcnt == 1) { + *pkg = NULL; + } Py_DECREF(result); - return CR_CB_RET_OK; } @@ -87,6 +89,7 @@ c_pkgcb(cr_Package *pkg, void *cbdata, GError **err) { + // destroys "pkg" PyObject *arglist, *result, *py_pkg; CbData *data = cbdata; |