From 40d7eb504ca248610c99cf3f6e95f7727df59fd5 Mon Sep 17 00:00:00 2001 From: Jeremy Sowden Date: Fri, 21 Jun 2019 11:50:31 +0100 Subject: [PATCH] wmail: fixed NULL-pointer dereference if opendir(3) fails. Code was: if (( dir = opendir( ... ))) { // ... } closedir( dir ); // dir may be NULL Moved closedir(3) inside if-block. --- wmail/src/wmail.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/wmail/src/wmail.c b/wmail/src/wmail.c index a7bb032..80b3684 100644 --- a/wmail/src/wmail.c +++ b/wmail/src/wmail.c @@ -981,9 +981,9 @@ static int TraverseDirectory( const char *name, bool isNewMail ) } free( fullName ); } - } - closedir( dir ); + closedir( dir ); + } return mails; } -- 2.11.4.GIT