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) 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 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 it under the terms of the GNU General Public License as published by
...@@ -183,7 +184,8 @@ MY_DIR *my_dir(const char *path, myf MyFlags) ...@@ -183,7 +184,8 @@ MY_DIR *my_dir(const char *path, myf MyFlags)
my_errno=errno; my_errno=errno;
if (dirp) if (dirp)
(void) closedir(dirp); (void) closedir(dirp);
my_dirend(&dirh->dir); if (dirh)
my_dirend(&dirh->dir);
if (MyFlags & (MY_FAE | MY_WME)) if (MyFlags & (MY_FAE | MY_WME))
my_error(EE_DIR, MYF(ME_BELL | ME_WAITTANG), path, my_errno); my_error(EE_DIR, MYF(ME_BELL | ME_WAITTANG), path, my_errno);
DBUG_RETURN(NULL); DBUG_RETURN(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