]> git.ipfire.org Git - thirdparty/libarchive.git/commit
Don't leak `entry` in `file_to_archive` if archive_read_disk_entry_from_file 843/head
authorNgie Cooper <yanegomi@gmail.com>
Tue, 13 Dec 2016 03:32:32 +0000 (19:32 -0800)
committerNgie Cooper <yanegomi@gmail.com>
Tue, 13 Dec 2016 03:39:11 +0000 (19:39 -0800)
commit5e14d06a9bf38f8b4707415e2ab03f4794d56e39
tree03ee44396447366d4bec91d83076cadb578e7590
parent54546be8a7a2e69738247d68f4f6c253430a3d6f
Don't leak `entry` in `file_to_archive` if archive_read_disk_entry_from_file
fails with `ARCHIVE_FAILED`

This greatly reduces memory usage when the call fails, e.g. a file cannot be
stat'ed

Confirmed with the following snippet:

% d=/tmp/cpio_test
% mkdir -p $d
% while : ; do echo /nonexistent ; done | cpio -dump $d 2>/dev/null

Reported by: Coverity
CID: 1016757
cpio/cpio.c