[pygobject] Fix some small memory leaks
- From: Patrick Griffis <pgriffis src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [pygobject] Fix some small memory leaks
- Date: Mon, 23 Aug 2021 16:15:45 +0000 (UTC)
commit c4d1b44fe0d69a49d70f1b7b287ea2377947703e
Author: David King <amigadave amigadave com>
Date: Wed Jul 14 10:35:52 2021 +0100
Fix some small memory leaks
Found by Coverity.
https://bugzilla.redhat.com/show_bug.cgi?id=1938851
gi/pygflags.c | 5 ++++-
gi/pygi-info.c | 1 +
2 files changed, 5 insertions(+), 1 deletion(-)
---
diff --git a/gi/pygflags.c b/gi/pygflags.c
index a9c443b6..df1280f9 100644
--- a/gi/pygflags.c
+++ b/gi/pygflags.c
@@ -108,10 +108,13 @@ pyg_flags_repr(PyGFlags *self)
tmp = generate_repr(self->gtype, (guint)PyLong_AsUnsignedLongMask ((PyObject*)self));
module = PyObject_GetAttrString ((PyObject *)self, "__module__");
- if (module == NULL)
+ if (module == NULL) {
+ g_free (tmp);
return NULL;
+ }
if (!PyUnicode_Check (module)) {
+ g_free (tmp);
Py_DECREF (module);
return NULL;
}
diff --git a/gi/pygi-info.c b/gi/pygi-info.c
index 19894e49..aee5d4db 100644
--- a/gi/pygi-info.c
+++ b/gi/pygi-info.c
@@ -1862,6 +1862,7 @@ _pygi_g_registered_type_info_check_object (GIRegisteredTypeInfo *info,
object_type = (PyTypeObject *) PyObject_Type (object);
if (object_type == NULL) {
+ g_free (type_name_expected);
return -1;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]