diff options
author | kientzle <kientzle@FreeBSD.org> | 2005-09-21 04:25:06 +0000 |
---|---|---|
committer | kientzle <kientzle@FreeBSD.org> | 2005-09-21 04:25:06 +0000 |
commit | dcb8de96ab47d1932ce313adbac5a673210b1c91 (patch) | |
tree | 6f61f48765d8080ef9566d9cbfc0f3e97cefd834 /lib/libarchive/archive_read_open_filename.c | |
parent | b035b8b7b3780581ed55ea9ca0660c0af57f5a5b (diff) | |
download | FreeBSD-src-dcb8de96ab47d1932ce313adbac5a673210b1c91.zip FreeBSD-src-dcb8de96ab47d1932ce313adbac5a673210b1c91.tar.gz |
Add a lot of error checks, based on the patches provided by Dan Lukes.
Also fixes a memory leak reported by Andrew Turner.
PR: bin/83476
Thanks to: Dan Lukes, Andrew Turner
Diffstat (limited to 'lib/libarchive/archive_read_open_filename.c')
-rw-r--r-- | lib/libarchive/archive_read_open_filename.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/lib/libarchive/archive_read_open_filename.c b/lib/libarchive/archive_read_open_filename.c index ea8ebbd..b0db61c 100644 --- a/lib/libarchive/archive_read_open_filename.c +++ b/lib/libarchive/archive_read_open_filename.c @@ -83,6 +83,10 @@ file_open(struct archive *a, void *client_data) struct stat st; mine->buffer = malloc(mine->block_size); + if (mine->buffer == NULL) { + archive_set_error(a, ENOMEM, "No memory"); + return (ARCHIVE_FATAL); + } if (mine->filename[0] != '\0') mine->fd = open(mine->filename, O_RDONLY); else |