Skip to content

Commit

Permalink
Close file before the handle is out of scope it in AppleRemote code. …
Browse files Browse the repository at this point in the history
…This was one of the cppcheck reported errors.
  • Loading branch information
daniel-kristjansson committed Jan 23, 2012
1 parent 6b227f4 commit 213b757
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions mythtv/libs/libmythui/AppleRemote.cpp
Expand Up @@ -142,11 +142,9 @@ static float GetATVversion()
float version = 0.0;
if ( strstr(hw_model,"AppleTV1,1") )
{
FILE *inpipe;
char linebuf[1000];

// Find the build version of the AppleTV OS
inpipe = popen("sw_vers -buildVersion", "r");
FILE *inpipe = popen("sw_vers -buildVersion", "r");
char linebuf[1000];
if (inpipe && fgets(linebuf, sizeof(linebuf) - 1, inpipe) )
{
if ( strstr(linebuf,"8N5107") ) version = 1.0;
Expand All @@ -158,9 +156,9 @@ static float GetATVversion()
else if (strstr(linebuf,"8N5622") ) version = 2.2;
else
version = 2.3;

pclose(inpipe);
}
if (inpipe)
pclose(inpipe);
}
return version;
}
Expand Down

0 comments on commit 213b757

Please sign in to comment.