]> git.ipfire.org Git - thirdparty/public-inbox.git/commitdiff
xap_helper: fix leak from shared reader locks
authorEric Wong <e@80x24.org>
Sun, 26 Oct 2025 00:16:45 +0000 (00:16 +0000)
committerEric Wong <e@80x24.org>
Mon, 27 Oct 2025 17:40:53 +0000 (17:40 +0000)
Caught by both valgrind and ASan, but I've been forgetting both
of them on my ancient laptop :x

lib/PublicInbox/xap_helper.h

index 658c1cc7f5ead6e845ec52f18ed404df3443cec9..511ce58ee7b16ad459761525bdfc599172340d85 100644 (file)
@@ -277,6 +277,7 @@ static void unlock_ensure(void *ptr)
        for (int i = 0; i < lk->req->lockc; i++)
                if (lk->lock_fd[i] >= 0)
                        xclose(lk->lock_fd[i]); // implicit LOCK_UN
+       free(lk);
 }
 
 static struct open_locks *lock_shared_maybe(struct req *req)