Skip to content

Commit

Permalink
Free hdhomerun device after use - fixes memory leak
Browse files Browse the repository at this point in the history
The codes created the hdhr device, but did not
release the storage after use resulting in a
memory leak.

Fixes Coverity 700660 700661 700662

Fixes #11669.

Signed-off-by: Paul Harrison <pharrison@mythtv.org>
  • Loading branch information
garybuhrmaster authored and Paul Harrison committed Jul 12, 2013
1 parent fe97815 commit 3d649d5
Showing 1 changed file with 16 additions and 2 deletions.
18 changes: 16 additions & 2 deletions mythtv/libs/libmythtv/cardutil.cpp
Expand Up @@ -115,11 +115,14 @@ bool CardUtil::IsCableCardPresent(uint cardid,
if (oob > 0 && (strncmp(status.channel, "none", 4) != 0))
{
LOG(VB_GENERAL, LOG_INFO, "Cardutil: HDHomeRun Cablecard Present.");
hdhomerun_device_destroy(hdhr);
return true;
}
else

hdhomerun_device_destroy(hdhr);

#endif
return false;
return false;
}
else if (cardType == "CETON")
{
Expand Down Expand Up @@ -2354,7 +2357,13 @@ bool CardUtil::HDHRdoesDVB(const QString &device)

const char *model = hdhomerun_device_get_model_str(hdhr);
if (model && strstr(model, "dvb"))
{
hdhomerun_device_destroy(hdhr);
return true;
}

hdhomerun_device_destroy(hdhr);

#endif

return false;
Expand Down Expand Up @@ -2394,7 +2403,10 @@ QString CardUtil::GetHDHRdesc(const QString &device)

const char *model = hdhomerun_device_get_model_str(hdhr);
if (!model)
{
hdhomerun_device_destroy(hdhr);
return connectErr;
}


QString description = model;
Expand All @@ -2404,6 +2416,8 @@ QString CardUtil::GetHDHRdesc(const QString &device)
if (hdhomerun_device_get_version(hdhr, &sVersion, &iVersion))
description += QObject::tr(", firmware: %2").arg(sVersion);

hdhomerun_device_destroy(hdhr);

return description;
#else

Expand Down

0 comments on commit 3d649d5

Please sign in to comment.