Commit d6b7738d authored by Vladislav Vaintroub's avatar Vladislav Vaintroub

Fix potential null pointer access after the allocation error

parent 234ae43d
......@@ -196,6 +196,8 @@ datadir_iter_new(const char *path, bool skip_first_level = true)
datadir_iter_t *it;
it = static_cast<datadir_iter_t *>(malloc(sizeof(datadir_iter_t)));
if (!it)
goto error;
memset(it, 0, sizeof(datadir_iter_t));
pthread_mutex_init(&it->mutex, NULL);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment