summaryrefslogtreecommitdiffstats
path: root/usr.bin/ar
diff options
context:
space:
mode:
authorbdrewery <bdrewery@FreeBSD.org>2015-10-29 19:28:21 +0000
committerbdrewery <bdrewery@FreeBSD.org>2015-10-29 19:28:21 +0000
commit1cd45a8b51762d2cde8fa358d00a0f996acefe90 (patch)
tree0ec3ef0fade0d3c41b20e00647bc9b1d379ab227 /usr.bin/ar
parentdffa7f059007d1b280106319e1aafa8d4958ba45 (diff)
downloadFreeBSD-src-1cd45a8b51762d2cde8fa358d00a0f996acefe90.zip
FreeBSD-src-1cd45a8b51762d2cde8fa358d00a0f996acefe90.tar.gz
Check archive_entry_new() result.
Coverity CID: 1331341
Diffstat (limited to 'usr.bin/ar')
-rw-r--r--usr.bin/ar/write.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/usr.bin/ar/write.c b/usr.bin/ar/write.c
index 10b912e..f78fbda 100644
--- a/usr.bin/ar/write.c
+++ b/usr.bin/ar/write.c
@@ -664,6 +664,9 @@ write_objs(struct bsdar *bsdar)
if ((bsdar->s_cnt != 0 && !(bsdar->options & AR_SS)) ||
bsdar->options & AR_S) {
entry = archive_entry_new();
+ if (entry == NULL)
+ bsdar_errc(bsdar, EX_SOFTWARE, 0,
+ "archive_entry_new failed");
archive_entry_copy_pathname(entry, "/");
if ((bsdar->options & AR_D) == 0)
archive_entry_set_mtime(entry, time(NULL), 0);
@@ -681,6 +684,9 @@ write_objs(struct bsdar *bsdar)
/* write the archive string table, if any. */
if (bsdar->as != NULL) {
entry = archive_entry_new();
+ if (entry == NULL)
+ bsdar_errc(bsdar, EX_SOFTWARE, 0,
+ "archive_entry_new failed");
archive_entry_copy_pathname(entry, "//");
archive_entry_set_size(entry, bsdar->as_sz);
AC(archive_write_header(a, entry));
@@ -691,6 +697,9 @@ write_objs(struct bsdar *bsdar)
/* write normal members. */
TAILQ_FOREACH(obj, &bsdar->v_obj, objs) {
entry = archive_entry_new();
+ if (entry == NULL)
+ bsdar_errc(bsdar, EX_SOFTWARE, 0,
+ "archive_entry_new failed");
archive_entry_copy_pathname(entry, obj->name);
archive_entry_set_uid(entry, obj->uid);
archive_entry_set_gid(entry, obj->gid);
OpenPOWER on IntegriCloud