diff --git a/library/gnome-keyring.c b/library/gnome-keyring.c
index d25ad0c..b3e1f54 100644
--- a/library/gnome-keyring.c
+++ b/library/gnome-keyring.c
@@ -2268,34 +2268,40 @@ find_items_1_reply (GkrOperation *op, DBusMessage *reply, gpointer data)
 	if (gkr_operation_handle_errors (op, reply))
 		return;
 
-	if (!dbus_message_get_args (reply, NULL,
+	/* These must be freed in all code paths */
+	unlocked = NULL;
+	locked = NULL;
+
+	if (dbus_message_get_args (reply, NULL,
 	                            DBUS_TYPE_ARRAY, DBUS_TYPE_OBJECT_PATH, &unlocked, &n_unlocked,
 	                            DBUS_TYPE_ARRAY, DBUS_TYPE_OBJECT_PATH, &locked, &n_locked,
 	                            DBUS_TYPE_INVALID)) {
-		gkr_operation_complete (op, decode_invalid_response (reply));
-		return;
-	}
 
-	/* Did we find anything? */
-	if (!n_unlocked && !n_locked) {
-		gkr_operation_complete (op, GNOME_KEYRING_RESULT_NO_MATCH);
-		return;
-	}
+		/* Did we find anything? */
+		if (n_unlocked > 0 || n_locked > 0) {
 
-	/* These are ready to retrieve */
-	for (i = 0; i < n_unlocked; ++i)
-		g_ptr_array_add (args->paths, g_strdup (unlocked[i]));
+			/* These are ready to retrieve */
+			for (i = 0; i < n_unlocked; ++i)
+				g_ptr_array_add (args->paths, g_strdup (unlocked[i]));
 
-	/* Do we have any to unlock? */
-	if (n_locked) {
-		req = prepare_xlock ("Unlock", locked, n_locked);
-		gkr_operation_push (op, find_items_2_reply, GKR_CALLBACK_OP_MSG, args, NULL);
-		gkr_operation_request (op, req);
+			/* Do we have any to unlock? */
+			if (n_locked > 0) {
+				req = prepare_xlock ("Unlock", locked, n_locked);
+				gkr_operation_push (op, find_items_2_reply, GKR_CALLBACK_OP_MSG, args, NULL);
+				gkr_operation_request (op, req);
+
+			/* Well we're going to be transferring secrets, so need a session */
+			} else {
+				gkr_operation_push (op, find_items_4_reply, GKR_CALLBACK_OP_SESSION, args, NULL);
+				gkr_session_negotiate (op);
+			}
+
+		} else {
+			gkr_operation_complete (op, GNOME_KEYRING_RESULT_NO_MATCH);
+		}
 
-	/* Well we're going to be transferring secrets, so need a session */
 	} else {
-		gkr_operation_push (op, find_items_4_reply, GKR_CALLBACK_OP_SESSION, args, NULL);
-		gkr_session_negotiate (op);
+		gkr_operation_complete (op, decode_invalid_response (reply));
 	}
 
 	dbus_free_string_array (locked);
@@ -2434,12 +2440,15 @@ gnome_keyring_find_itemsv (GnomeKeyringItemType                  type,
 {
 	GnomeKeyringAttributeList *attributes;
 	va_list args;
+	gpointer ret;
 
 	va_start (args, destroy_data);
 	attributes = make_attribute_list_va (args);
 	va_end (args);
 
-	return gnome_keyring_find_items (type, attributes, callback, data, destroy_data);
+	ret = gnome_keyring_find_items (type, attributes, callback, data, destroy_data);
+	gnome_keyring_attribute_list_free(attributes);
+	return ret;
 }
 
 /**
@@ -2506,6 +2515,7 @@ gnome_keyring_find_itemsv_sync  (GnomeKeyringItemType        type,
 {
 	GnomeKeyringAttributeList *attributes;
 	va_list args;
+	GnomeKeyringResult ret;
 
 	g_return_val_if_fail (found, GNOME_KEYRING_RESULT_BAD_ARGUMENTS);
 
@@ -2513,7 +2523,9 @@ gnome_keyring_find_itemsv_sync  (GnomeKeyringItemType        type,
 	attributes = make_attribute_list_va (args);
 	va_end (args);
 
-	return gnome_keyring_find_items_sync (type, attributes, found);
+	ret = gnome_keyring_find_items_sync (type, attributes, found);
+	gnome_keyring_attribute_list_free(attributes);
+	return ret;
 }
 
 /**
