]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lib-dict: Discard result when callback is NULL on async call
authorAki Tuomi <aki.tuomi@dovecot.fi>
Tue, 6 Sep 2016 13:02:26 +0000 (16:02 +0300)
committerGitLab <gitlab@git.dovecot.net>
Wed, 7 Sep 2016 09:25:21 +0000 (12:25 +0300)
src/lib-dict/dict-client.c

index 5a8f7e347fdc4c51fb9b4c1988eab0b12f17c177..9fa365cd649046c7081cfebc07ccc8f96c953d29 100644 (file)
@@ -1073,8 +1073,10 @@ client_dict_transaction_commit_callback(struct client_dict_cmd *cmd,
 
 static void commit_sync_callback(int ret, void *context)
 {
-       int *ret_p = context;
-       *ret_p = ret;
+       if (context != NULL) {
+               int *ret_p = context;
+               *ret_p = ret;
+       }
 }
 
 static int
@@ -1103,7 +1105,7 @@ client_dict_transaction_commit(struct dict_transaction_context *_ctx,
                        cmd->api_callback.context = context;
                } else {
                        cmd->api_callback.commit = commit_sync_callback;
-                       cmd->api_callback.context = &ret;
+                       cmd->api_callback.context = (async ? NULL : &ret);
                        if (async)
                                cmd->background = TRUE;
                }