Use auto_ptr instead of following the pointer to suppress possible leaks.
From: Erik Hovland <erik@hovland.org>
---
libs/libmythtv/siscan.cpp | 16 ++++++++--------
1 files changed, 8 insertions(+), 8 deletions(-)
diff --git a/libs/libmythtv/siscan.cpp b/libs/libmythtv/siscan.cpp
index 58411a2..83a7911 100644
a
|
b
|
|
5 | 5 | #include <pthread.h> |
6 | 6 | #include <unistd.h> |
7 | 7 | |
| 8 | // C++ includes |
| 9 | #include <memory> |
| 10 | |
8 | 11 | // Qt includes |
9 | 12 | #include <qmutex.h> |
10 | 13 | |
… |
… |
void SIScan::UpdateSDTinDB(int /*mplexid*/, const ServiceDescriptionTable *sdt, |
1426 | 1429 | for (uint i = 0; i < sdt->ServiceCount(); i++) |
1427 | 1430 | { |
1428 | 1431 | // Figure out best service name... |
1429 | | ServiceDescriptor *desc = sdt->GetServiceDescriptor(i); |
| 1432 | std::auto_ptr<ServiceDescriptor> desc(sdt->GetServiceDescriptor(i)); |
1430 | 1433 | QString service_name = ""; |
1431 | | if (desc) |
| 1434 | if (desc.get()) |
1432 | 1435 | service_name = desc->ServiceName(); |
1433 | 1436 | |
1434 | 1437 | if (service_name.stripWhiteSpace().isEmpty()) |
… |
… |
void SIScan::UpdateSDTinDB(int /*mplexid*/, const ServiceDescriptionTable *sdt, |
1443 | 1446 | chan_num = QString::number(dvbChanNums[sdt->ServiceID(i)]); |
1444 | 1447 | |
1445 | 1448 | // Skip to next if this is a service we don't care for |
1446 | | if (desc && desc->IsDigitalAudio() && ignoreAudioOnlyServices) |
| 1449 | if (desc.get() && desc->IsDigitalAudio() && ignoreAudioOnlyServices) |
1447 | 1450 | { |
1448 | 1451 | IgnoreAudioOnlyMsg(service_name, sdt->ServiceID(i)); |
1449 | 1452 | continue; |
1450 | 1453 | } |
1451 | | else if (desc && !desc->IsDTV() && !desc->IsDigitalAudio() && |
| 1454 | else if (desc.get() && !desc->IsDTV() && !desc->IsDigitalAudio() && |
1452 | 1455 | ignoreDataServices) |
1453 | 1456 | { |
1454 | 1457 | IgnoreDataOnlyMsg(service_name, sdt->ServiceID(i)); |
… |
… |
void SIScan::UpdateSDTinDB(int /*mplexid*/, const ServiceDescriptionTable *sdt, |
1504 | 1507 | default_authority); |
1505 | 1508 | } |
1506 | 1509 | } |
1507 | | else if (force_update || (desc && have_uk_chan_num)) |
| 1510 | else if (force_update || (desc.get() && have_uk_chan_num)) |
1508 | 1511 | { // The service is in database & we have good info, update it |
1509 | 1512 | emit ServiceScanUpdateText(tr("Updating %1").arg(service_name)); |
1510 | 1513 | |
… |
… |
void SIScan::UpdateSDTinDB(int /*mplexid*/, const ServiceDescriptionTable *sdt, |
1541 | 1544 | "we don't have better data.") |
1542 | 1545 | .arg(service_name)); |
1543 | 1546 | } |
1544 | | |
1545 | | if (desc) |
1546 | | delete desc; |
1547 | 1547 | } |
1548 | 1548 | } |
1549 | 1549 | |