[gnome-keyring/trust-store: 6/7] [gcr] Fix memory leaks in async functions.
- From: Stefan Walter <stefw src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-keyring/trust-store: 6/7] [gcr] Fix memory leaks in async functions.
- Date: Mon, 13 Dec 2010 19:39:14 +0000 (UTC)
commit 5273a8e0562587158037bed9b26292ef9c8873a8
Author: Stef Walter <stefw collabora co uk>
Date: Mon Dec 13 19:38:13 2010 +0000
[gcr] Fix memory leaks in async functions.
g_async_result_get_source_object() refs its result.
gcr/gcr-pkcs11-certificate.c | 6 ++++--
gcr/gcr-trust.c | 12 ++++++++++--
2 files changed, 14 insertions(+), 4 deletions(-)
---
diff --git a/gcr/gcr-pkcs11-certificate.c b/gcr/gcr-pkcs11-certificate.c
index d7564b9..e8dbd31 100644
--- a/gcr/gcr-pkcs11-certificate.c
+++ b/gcr/gcr-pkcs11-certificate.c
@@ -405,11 +405,13 @@ GcrCertificate*
gcr_pkcs11_certificate_lookup_issuer_finish (GAsyncResult *result, GError **error)
{
GcrCertificate *cert;
+ GObject *source;
g_return_val_if_fail (G_IS_ASYNC_RESULT (result), NULL);
- g_return_val_if_fail (g_simple_async_result_is_valid (result,
- g_async_result_get_source_object (result),
+ source = g_async_result_get_source_object (result);
+ g_return_val_if_fail (g_simple_async_result_is_valid (result, source,
gcr_pkcs11_certificate_lookup_issuer_async), NULL);
+ g_object_unref (source);
if (g_simple_async_result_propagate_error (G_SIMPLE_ASYNC_RESULT (result), error))
return NULL;
diff --git a/gcr/gcr-trust.c b/gcr/gcr-trust.c
index 045f8cf..333102e 100644
--- a/gcr/gcr-trust.c
+++ b/gcr/gcr-trust.c
@@ -334,6 +334,7 @@ gcr_trust_is_certificate_pinned_finish (GAsyncResult *result, GError **error)
{
GcrTrustOperation *op;
GObject *object;
+ gboolean found;
g_return_val_if_fail (G_IS_SIMPLE_ASYNC_RESULT (result), FALSE);
g_return_val_if_fail (!error || !*error, FALSE);
@@ -348,7 +349,9 @@ gcr_trust_is_certificate_pinned_finish (GAsyncResult *result, GError **error)
return FALSE;
op = trust_operation_get (GCK_ENUMERATOR (object));
- return op->found;
+ found = op->found;
+ g_object_unref (object);
+ return found;
}
/* ----------------------------------------------------------------------------------
@@ -568,6 +571,7 @@ gcr_trust_add_pinned_certificate_finish (GAsyncResult *result, GError **error)
object = g_async_result_get_source_object (result);
g_return_val_if_fail (g_simple_async_result_is_valid (result, object,
gcr_trust_add_pinned_certificate_async), FALSE);
+ g_object_unref (object);
if (g_simple_async_result_propagate_error (G_SIMPLE_ASYNC_RESULT (result), error))
return FALSE;
@@ -766,6 +770,7 @@ gcr_trust_remove_pinned_certificate_finish (GAsyncResult *result, GError **error
object = g_async_result_get_source_object (result);
g_return_val_if_fail (g_simple_async_result_is_valid (result, object,
gcr_trust_remove_pinned_certificate_async), FALSE);
+ g_object_unref (object);
if (g_simple_async_result_propagate_error (G_SIMPLE_ASYNC_RESULT (result), error))
return FALSE;
@@ -937,6 +942,7 @@ gcr_trust_is_certificate_anchored_finish (GAsyncResult *result, GError **error)
{
GcrTrustOperation *op;
GObject *object;
+ gboolean found;
g_return_val_if_fail (G_IS_ASYNC_RESULT (result), FALSE);
g_return_val_if_fail (!error || !*error, FALSE);
@@ -951,5 +957,7 @@ gcr_trust_is_certificate_anchored_finish (GAsyncResult *result, GError **error)
return FALSE;
op = trust_operation_get (GCK_ENUMERATOR (object));
- return op->found;
+ found = op->found;
+ g_object_unref (object);
+ return found;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]