From 494fd64314f879cff80e97d6a20789bfcb62e717 Mon Sep 17 00:00:00 2001 From: Peter Howkins Date: Thu, 5 Apr 2018 18:16:10 +0100 Subject: [PATCH] dtinfo/dtinfogen: Fix segfault introduced by over zealously fixing coverity resource leak --- cde/programs/dtinfo/dtinfogen/infolib/etc/SearchPath.C | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/cde/programs/dtinfo/dtinfogen/infolib/etc/SearchPath.C b/cde/programs/dtinfo/dtinfogen/infolib/etc/SearchPath.C index 1323505e..095c6909 100644 --- a/cde/programs/dtinfo/dtinfogen/infolib/etc/SearchPath.C +++ b/cde/programs/dtinfo/dtinfogen/infolib/etc/SearchPath.C @@ -128,7 +128,7 @@ char * SearchPath::get_real_path( const char *file_name ) { CC_TPtrSlistIterator path_it( *search_path_table ); - FILE *fp; + FILE *fp = NULL; if (file_name == NULL || *file_name == '\0') return NULL; @@ -149,7 +149,9 @@ SearchPath::get_real_path( const char *file_name ) fclose( fp ); return ( full_path_name ); } - fclose( fp ); + if(fp) { + fclose( fp ); + } } return NULL; -- 2.25.1