]> git.ipfire.org Git - thirdparty/libarchive.git/commit
archive_write_client: Free state in freer, not in closer
authorDag-Erling Smørgrav <des@des.no>
Mon, 8 Sep 2025 19:14:04 +0000 (21:14 +0200)
committerDag-Erling Smørgrav <des@des.no>
Mon, 8 Sep 2025 21:15:57 +0000 (23:15 +0200)
commit06191cd28765cf492c32cd0069737c629955f84d
tree0ec80e29faf13868c1cdead8c986cdec0899a711
parent53135ca48ed948216c1875888c8a1e30761610a1
archive_write_client: Free state in freer, not in closer

The closer will not be called if a fatal error occurs, so the current
arrangement results in a memory leak.  The downside is that the freer
may be called even if we were not fully constructed, so it needs to
perform additional checks.  On the other hand, knowing that the freer
always gets called and will free the client state simplifies error
handling in the opener.
libarchive/archive_write.c