cups-pk-helper/cups-pk-helper-check-mechanism.patch
2011-08-05 16:26:40 +02:00

24 lines
764 B
Diff

diff --git a/src/cups-pk-helper-mechanism.c b/src/cups-pk-helper-mechanism.c
index 273c262..8b3d781 100644
--- a/src/cups-pk-helper-mechanism.c
+++ b/src/cups-pk-helper-mechanism.c
@@ -205,6 +205,8 @@ register_mechanism (CphMechanism *mechanism)
{
GError *error;
+ g_return_val_if_fail (CPH_IS_MECHANISM (mechanism), FALSE);
+
mechanism->priv->pol_auth = polkit_authority_get ();
error = NULL;
@@ -238,7 +240,8 @@ cph_mechanism_new (void)
object = g_object_new (CPH_TYPE_MECHANISM, NULL);
if (!register_mechanism (CPH_MECHANISM (object))) {
- g_object_unref (object);
+ if (object)
+ g_object_unref (object);
return NULL;
}