summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartin Matuska <martin@matuska.de>2022-12-08 16:05:53 +0100
committerMartin Matuska <martin@matuska.de>2022-12-08 16:05:53 +0100
commit92d2835fed1e9be1e6fd49949bdef917df577274 (patch)
tree93ebf0a658075242032589be1eda42487ee623e3
parent186116ce9a312929656fb977e57ec49aaee099c2 (diff)
downloadlibarchive-92d2835fed1e9be1e6fd49949bdef917df577274.tar.gz
archive_read_disk_posix: fail if unable to alocate memory in tree_push()
Reported by: GitHub CodeQL Code Scanning Alert: 189
-rw-r--r--libarchive/archive_read_disk_posix.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/libarchive/archive_read_disk_posix.c b/libarchive/archive_read_disk_posix.c
index a96008db..5a94ec5d 100644
--- a/libarchive/archive_read_disk_posix.c
+++ b/libarchive/archive_read_disk_posix.c
@@ -2102,6 +2102,8 @@ tree_push(struct tree *t, const char *path, int filesystem_id,
struct tree_entry *te;
te = calloc(1, sizeof(*te));
+ if (te == NULL)
+ __archive_errx(1, "Out of memory");
te->next = t->stack;
te->parent = t->current;
if (te->parent)