base-sms: reduce possibility of leaking multipart reference

Move error paths after getting a multipart reference to before getting
one, to reduce the possiblity that we get a reference from the MMSmsList
that ultimately doesn't end up getting used.

Signed-off-by: Dan Williams <dan@ioncontrol.co>
This commit is contained in:
Dan Williams
2025-05-08 20:24:38 -05:00
parent 1781ffaad4
commit c6af442053
+8 -8
View File
@@ -469,14 +469,6 @@ handle_store_auth_ready (MMAuthProvider *authp,
return;
}
/* Prepare the SMS to be stored, creating the PDU list if required */
if (!prepare_sms_to_be_stored (ctx->self, &error)) {
mm_obj_warn (ctx->self, "failed preparing SMS message to be stored: %s", error->message);
mm_dbus_method_invocation_take_error (ctx->invocation, error);
handle_store_context_free (ctx);
return;
}
/* If not stored, check if we do support doing it */
if (!MM_BASE_SMS_GET_CLASS (ctx->self)->store ||
!MM_BASE_SMS_GET_CLASS (ctx->self)->store_finish) {
@@ -487,6 +479,14 @@ handle_store_auth_ready (MMAuthProvider *authp,
return;
}
/* Prepare the SMS to be stored, creating the PDU list if required */
if (!prepare_sms_to_be_stored (ctx->self, &error)) {
mm_obj_warn (ctx->self, "failed preparing SMS message to be stored: %s", error->message);
mm_dbus_method_invocation_take_error (ctx->invocation, error);
handle_store_context_free (ctx);
return;
}
MM_BASE_SMS_GET_CLASS (ctx->self)->store (ctx->self,
ctx->storage,
(GAsyncReadyCallback)handle_store_ready,