Fix a few memory leaks (via Fedora).

This commit is contained in:
ajacoutot 2017-04-16 15:37:41 +00:00
parent 0685438ec0
commit 0fdc9fcf8d
4 changed files with 87 additions and 5 deletions

View File

@ -1,9 +1,9 @@
# $OpenBSD: Makefile,v 1.66 2016/03/11 20:28:32 naddy Exp $
# $OpenBSD: Makefile,v 1.67 2017/04/16 15:37:41 ajacoutot Exp $
COMMENT= framework for granting privileged operations to users
DISTNAME= polkit-0.113
REVISION= 3
REVISION= 4
SHARED_LIBS += polkit-gobject-1 2.0 # .0.0
SHARED_LIBS += polkit-agent-1 2.0 # .0.0

View File

@ -0,0 +1,17 @@
$OpenBSD: patch-src_polkit_polkitpermission_c,v 1.1 2017/04/16 15:37:41 ajacoutot Exp $
From dfd2c165447029c32510842350e924ef5ac3f679 Mon Sep 17 00:00:00 2001
From: Rui Matos <tiagomatos@gmail.com>
Date: Thu, 2 Mar 2017 14:50:31 +0100
Subject: [PATCH] polkitpermission: Fix a memory leak on authority changes
--- src/polkit/polkitpermission.c.orig Sat Jun 6 01:24:06 2015
+++ src/polkit/polkitpermission.c Sun Apr 16 17:30:52 2017
@@ -454,6 +454,7 @@ changed_check_cb (GObject *source_object,
if (result != NULL)
{
process_result (permission, result);
+ g_object_unref (result);
}
else
{

View File

@ -0,0 +1,33 @@
$OpenBSD: patch-src_polkitbackend_polkitbackendauthority_c,v 1.1 2017/04/16 15:37:41 ajacoutot Exp $
commit af4566e1a7e9031b9a05f49c7d27bf379d822016
Author: Miloslav Trmač <mitr@redhat.com>
Date: Thu Feb 9 19:53:54 2017 +0100
Fix a memory leak per agent authentication
--- src/polkitbackend/polkitbackendauthority.c.orig Sun Apr 16 17:34:05 2017
+++ src/polkitbackend/polkitbackendauthority.c Sun Apr 16 17:34:10 2017
@@ -1007,6 +1007,7 @@ server_handle_unregister_authentication_agent (Server
g_dbus_method_invocation_return_value (invocation, g_variant_new ("()"));
out:
+ g_variant_unref (subject_gvariant);
if (subject != NULL)
g_object_unref (subject);
}
@@ -1057,6 +1058,7 @@ server_handle_authentication_agent_response (Server
g_dbus_method_invocation_return_value (invocation, g_variant_new ("()"));
out:
+ g_variant_unref (identity_gvariant);
if (identity != NULL)
g_object_unref (identity);
}
@@ -1107,6 +1109,7 @@ server_handle_authentication_agent_response2 (Server
g_dbus_method_invocation_return_value (invocation, g_variant_new ("()"));
out:
+ g_variant_unref (identity_gvariant);
if (identity != NULL)
g_object_unref (identity);
}

View File

@ -1,12 +1,17 @@
$OpenBSD: patch-src_polkitbackend_polkitbackendinteractiveauthority_c,v 1.6 2015/07/20 20:16:59 ajacoutot Exp $
$OpenBSD: patch-src_polkitbackend_polkitbackendinteractiveauthority_c,v 1.7 2017/04/16 15:37:41 ajacoutot Exp $
From 074df27827fd773f1c76545cd08da568440ca41f Mon Sep 17 00:00:00 2001
From: Antoine Jacoutot <ajacoutot@gnome.org>
Date: Sun, 19 Jul 2015 02:19:08 +0200
Subject: Add support for OpenBSD
commit 7ecf29a9db86f7161e2ff48e7bb8ea46a90f954f
Author: Miloslav Trma\xc4\x8d <mitr@redhat.com>
Date: Wed Feb 8 22:57:21 2017 +0100
Fix a memory leak in server_handle_authentication_agent_response{,2}
--- src/polkitbackend/polkitbackendinteractiveauthority.c.orig Fri Jun 19 22:39:58 2015
+++ src/polkitbackend/polkitbackendinteractiveauthority.c Sun Jul 19 02:08:14 2015
+++ src/polkitbackend/polkitbackendinteractiveauthority.c Sun Apr 16 17:31:32 2017
@@ -23,7 +23,11 @@
#include <errno.h>
#include <pwd.h>
@ -19,7 +24,34 @@ Subject: Add support for OpenBSD
#include <string.h>
#include <glib/gstdio.h>
#include <locale.h>
@@ -2236,7 +2240,11 @@ get_users_in_net_group (PolkitIdentity
@@ -1903,15 +1907,15 @@ authentication_agent_begin_cb (GDBusProxy *proxy,
AuthenticationSession *session = user_data;
gboolean gained_authorization;
gboolean was_dismissed;
+ GVariant *result;
GError *error;
was_dismissed = FALSE;
gained_authorization = FALSE;
error = NULL;
- if (!g_dbus_proxy_call_finish (proxy,
- res,
- &error))
+ result = g_dbus_proxy_call_finish (proxy, res, &error);
+ if (result == NULL)
{
g_printerr ("Error performing authentication: %s (%s %d)\n",
error->message,
@@ -1923,6 +1927,7 @@ authentication_agent_begin_cb (GDBusProxy *proxy,
}
else
{
+ g_variant_unref (result);
gained_authorization = session->is_authenticated;
g_debug ("Authentication complete, is_authenticated = %d", session->is_authenticated);
}
@@ -2236,7 +2241,11 @@ get_users_in_net_group (PolkitIdentity
for (;;)
{