Commit edd7e7c8 authored by Eugene Kosov's avatar Eugene Kosov

MDEV-22069 UBSAN: runtime error: member access within null pointer of type...

MDEV-22069 UBSAN: runtime error: member access within null pointer of type 'MY_DIR_HANDLE' in mysys/my_lib.c

This is an error handling bug. When opendir() fails dirh is NULL and
we shouldn't try to free it.
parent b11ff3d4
/* Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
Copyright (c) 2008, 2020, MariaDB Corporation.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
......@@ -183,6 +184,7 @@ MY_DIR *my_dir(const char *path, myf MyFlags)
my_errno=errno;
if (dirp)
(void) closedir(dirp);
if (dirh)
my_dirend(&dirh->dir);
if (MyFlags & (MY_FAE | MY_WME))
my_error(EE_DIR, MYF(ME_BELL | ME_WAITTANG), path, my_errno);
......
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