From 132feb71f55cfa5f9645cf2079974e2ade06fa62 Mon Sep 17 00:00:00 2001 From: Joseph Hunkeler Date: Fri, 3 May 2024 10:40:48 -0400 Subject: Prevent leak if delivery_init_tmpdir() is called more than once --- src/deliverable.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/deliverable.c b/src/deliverable.c index 7471489..36c2876 100644 --- a/src/deliverable.c +++ b/src/deliverable.c @@ -115,7 +115,10 @@ int delivery_init_tmpdir(struct Delivery *ctx) { goto l_delivery_init_tmpdir_fatal; } - globals.tmpdir = strdup(tmpdir); + if (!globals.tmpdir) { + globals.tmpdir = strdup(tmpdir); + } + if (!ctx->storage.tmpdir) { ctx->storage.tmpdir = strdup(globals.tmpdir); } -- cgit