From c6af442053d9959107c73e564731c3cb85e28981 Mon Sep 17 00:00:00 2001 From: Dan Williams Date: Sat, 19 Apr 2025 18:22:38 -0500 Subject: [PATCH] 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 --- src/mm-base-sms.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/mm-base-sms.c b/src/mm-base-sms.c index 22b91244..ecfee882 100644 --- a/src/mm-base-sms.c +++ b/src/mm-base-sms.c @@ -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,