diff --git a/src/task.c b/src/task.c
index 906b79aa769a823b09e3707ecc13b4642b3db8c4..2b4a5e74c94a0ddd46743481ac4cc81bbf9bd305 100644
--- a/src/task.c
+++ b/src/task.c
@@ -555,7 +555,9 @@ int task_lock(struct task *t) {
       }
 
       /* And log deactivation, if logging enabled. */
-      if (res) mpiuse_log_allocation(t->type, t->subtype, &t->req, 0, 0, 0, 0);
+      if (res) {
+        mpiuse_log_allocation(t->type, t->subtype, &t->req, 0, 0, 0, 0);
+      }
 
       return res;
 #else