]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
pgsql: Avoid crash in multi-command transaction if one of the queries couldn't be...
authorTimo Sirainen <tss@iki.fi>
Thu, 24 Sep 2015 13:41:10 +0000 (16:41 +0300)
committerTimo Sirainen <tss@iki.fi>
Thu, 24 Sep 2015 13:41:10 +0000 (16:41 +0300)
src/lib-sql/driver-pgsql.c

index ce215b5d4cb0365b727e0a64350399cd4f14fb87..430e4235b04521b68b864b5e6ba0e4a47822a937 100644 (file)
@@ -895,9 +895,11 @@ static bool transaction_send_next(void *context)
        }
 
        if (ctx->ctx.head != NULL) {
-               sql_query(ctx->ctx.db, ctx->ctx.head->query,
-                         transaction_update_callback, ctx->ctx.head);
+               struct sql_transaction_query *query = ctx->ctx.head;
+
                ctx->ctx.head = ctx->ctx.head->next;
+               sql_query(ctx->ctx.db, query->query,
+                         transaction_update_callback, query);
        } else {
                sql_query(ctx->ctx.db, "COMMIT",
                          transaction_commit_callback, ctx);