From d6b7738dcce85b83282fdab6702ac0b5985666d3 Mon Sep 17 00:00:00 2001 From: Vladislav Vaintroub Date: Wed, 1 Sep 2021 18:21:34 +0200 Subject: [PATCH] Fix potential null pointer access after the allocation error --- extra/mariabackup/backup_copy.cc | 2 ++ 1 file changed, 2 insertions(+) diff --git a/extra/mariabackup/backup_copy.cc b/extra/mariabackup/backup_copy.cc index 5637ec3d4d7..c46c32213d6 100644 --- a/extra/mariabackup/backup_copy.cc +++ b/extra/mariabackup/backup_copy.cc @@ -196,6 +196,8 @@ datadir_iter_new(const char *path, bool skip_first_level = true) datadir_iter_t *it; it = static_cast(malloc(sizeof(datadir_iter_t))); + if (!it) + goto error; memset(it, 0, sizeof(datadir_iter_t)); pthread_mutex_init(&it->mutex, NULL);