From 90f79edbea153c284d8221c9afdb1eefd945c376 Mon Sep 17 00:00:00 2001 From: Philip Kovacs Date: Fri, 1 Dec 2006 22:47:40 +0000 Subject: [PATCH] entropy: close fp1 on fp2 open failure git-svn-id: https://conky.svn.sourceforge.net/svnroot/conky/trunk/conky1@801 7f574dfc-610e-0410-a909-a81674777703 --- src/linux.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/linux.c b/src/linux.c index 8193a384..e5de7d09 100644 --- a/src/linux.c +++ b/src/linux.c @@ -1767,10 +1767,15 @@ void update_entropy (void) info.entropy.entropy_avail=0; info.entropy.poolsize=0; - if ( ((fp1 = open_file (entropy_avail, &rep))==NULL) || - ((fp2 = open_file (entropy_poolsize, &rep))==NULL) ) + if ((fp1 = open_file (entropy_avail, &rep))==NULL) return; + if ((fp2 = open_file (entropy_poolsize, &rep))==NULL) + { + fclose (fp1); + return; + } + fscanf (fp1, "%u", &info.entropy.entropy_avail); fscanf (fp2, "%u", &info.entropy.poolsize);