summaryrefslogtreecommitdiff
path: root/lib/sqfs/xattr/xattr_writer.c
diff options
context:
space:
mode:
authorDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>2020-11-07 17:06:33 +0100
committerDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>2020-12-29 12:37:37 +0100
commit40ca906fa9f2f0e4e325432aff00433f2bb731bd (patch)
tree20483c790558e19ac9f8d0bac06b8980c7a11f5f /lib/sqfs/xattr/xattr_writer.c
parent80ab27b469f60b1d367aa5d8e09acffd2911b911 (diff)
Fix: libsquashfs: xattr_writer: return NULL if calloc fails
Instead of dereferencing the NULL pointer and crashing. Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
Diffstat (limited to 'lib/sqfs/xattr/xattr_writer.c')
-rw-r--r--lib/sqfs/xattr/xattr_writer.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/lib/sqfs/xattr/xattr_writer.c b/lib/sqfs/xattr/xattr_writer.c
index c33d366..c04bd4a 100644
--- a/lib/sqfs/xattr/xattr_writer.c
+++ b/lib/sqfs/xattr/xattr_writer.c
@@ -89,6 +89,9 @@ sqfs_xattr_writer_t *sqfs_xattr_writer_create(sqfs_u32 flags)
return NULL;
xwr = calloc(1, sizeof(*xwr));
+ if (xwr == NULL)
+ return NULL;
+
if (str_table_init(&xwr->keys, XATTR_KEY_BUCKETS))
goto fail_keys;