diff options
author | midipix <writeonce@midipix.org> | 2024-03-10 15:24:37 +0000 |
---|---|---|
committer | midipix <writeonce@midipix.org> | 2024-03-10 15:24:37 +0000 |
commit | 9a3246173ce1d855beebe83f44849e2aa0cf2e4a (patch) | |
tree | c91f8238a03a2b84e692c1aea8d523537f61d16b /src/arbits/slbt_archive_ctx.c | |
parent | 39ce397bc705086b8856cc5c578244aabf093aa9 (diff) | |
download | slibtool-9a3246173ce1d855beebe83f44849e2aa0cf2e4a.tar.bz2 slibtool-9a3246173ce1d855beebe83f44849e2aa0cf2e4a.tar.xz |
slbt_ar_get_archive_ctx(): store a private copy of the archive path.
Diffstat (limited to 'src/arbits/slbt_archive_ctx.c')
-rw-r--r-- | src/arbits/slbt_archive_ctx.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/arbits/slbt_archive_ctx.c b/src/arbits/slbt_archive_ctx.c index a110e97..a22c806 100644 --- a/src/arbits/slbt_archive_ctx.c +++ b/src/arbits/slbt_archive_ctx.c @@ -52,6 +52,7 @@ static int slbt_ar_free_archive_ctx_impl(struct slbt_archive_ctx_impl * ctx, int if (ctx) { slbt_ar_free_archive_meta(ctx->meta); slbt_unmap_raw_archive(&ctx->map); + free(ctx->pathbuf); free(ctx); } @@ -84,8 +85,12 @@ int slbt_ar_get_archive_ctx( return slbt_ar_free_archive_ctx_impl(ctx, SLBT_NESTED_ERROR(dctx)); + if (!(ctx->pathbuf = strdup(path))) + return slbt_ar_free_archive_ctx_impl(ctx, + SLBT_NESTED_ERROR(dctx)); + ctx->dctx = dctx; - ctx->path = path; + ctx->path = ctx->pathbuf; ctx->actx.path = &ctx->path; ctx->actx.map = &ctx->map; ctx->actx.meta = ctx->meta; |