]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
push-notification-driver-lua: Reference mail user only if initialization is successful
authorAki Tuomi <aki.tuomi@dovecot.fi>
Mon, 24 Sep 2018 12:29:12 +0000 (15:29 +0300)
committerVille Savolainen <ville.savolainen@dovecot.fi>
Wed, 14 Nov 2018 12:01:53 +0000 (14:01 +0200)
Will cause assert-crash otherwise if initialization fails

src/plugins/push-notification/push-notification-driver-lua.c

index 6afca9c143365c1cbf93a1e0be8c9eeddb88ca21..418b21d097258147e793310d1f77803323ff4cb3 100644 (file)
@@ -119,8 +119,6 @@ static bool push_notification_driver_lua_begin_txn
 
        int luaerr;
 
-       mail_user_ref(user);
-
        config1 = p_new(dtxn->ptxn->pool,
                       struct push_notification_event_messagenew_config, 1);
        config1->flags = DLUA_DEFAULT_EVENTS;
@@ -160,6 +158,7 @@ static bool push_notification_driver_lua_begin_txn
 
        tctx->tx_ref = luaL_ref(ctx->script->L, LUA_REGISTRYINDEX);
        dtxn->context = tctx;
+       mail_user_ref(user);
 
        return TRUE;
 }