diff options
author | Joseph Hunkeler <jhunkeler@gmail.com> | 2024-05-03 10:40:48 -0400 |
---|---|---|
committer | Joseph Hunkeler <jhunkeler@gmail.com> | 2024-05-03 10:40:48 -0400 |
commit | 132feb71f55cfa5f9645cf2079974e2ade06fa62 (patch) | |
tree | c15a9b4b2265a7e6aeb30fbb973e7b718828e13b | |
parent | 958012d43120c704313bbbd6b1e3027cdffc9157 (diff) | |
download | stasis-132feb71f55cfa5f9645cf2079974e2ade06fa62.tar.gz |
Prevent leak if delivery_init_tmpdir() is called more than once
-rw-r--r-- | src/deliverable.c | 5 |
1 files changed, 4 insertions, 1 deletions
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); } |