summaryrefslogtreecommitdiff
path: root/libsi
diff options
context:
space:
mode:
authorKlaus Schmidinger <vdr@tvdr.de>2015-02-01 14:59:52 +0100
committerKlaus Schmidinger <vdr@tvdr.de>2015-02-01 14:59:52 +0100
commit471b287f700f4e74c940399d43567ca06dad779a (patch)
tree348b37116a9cbe8ad5b514dac6221a431418a8dd /libsi
parent1c4865147a01aec70fe6b8d1d4b5bd071c431cff (diff)
downloadvdr-471b287f700f4e74c940399d43567ca06dad779a.tar.gz
vdr-471b287f700f4e74c940399d43567ca06dad779a.tar.bz2
Fixed a memory leak in case of broken Extended Event Descriptors
Diffstat (limited to 'libsi')
-rw-r--r--libsi/si.c9
-rw-r--r--libsi/si.h4
2 files changed, 7 insertions, 6 deletions
diff --git a/libsi/si.c b/libsi/si.c
index 0ef39397..3d5169f6 100644
--- a/libsi/si.c
+++ b/libsi/si.c
@@ -6,7 +6,7 @@
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
- * $Id: si.c 3.1 2013/10/30 10:16:18 kls Exp $
+ * $Id: si.c 3.2 2015/02/01 14:55:27 kls Exp $
* *
***************************************************************************/
@@ -198,17 +198,18 @@ void DescriptorGroup::Delete() {
}
}
-void DescriptorGroup::Add(GroupDescriptor *d) {
+bool DescriptorGroup::Add(GroupDescriptor *d) {
if (!array) {
length=d->getLastDescriptorNumber()+1;
array=new GroupDescriptor*[length]; //numbering is zero-based
for (int i=0;i<length;i++)
array[i]=0;
} else if (length != d->getLastDescriptorNumber()+1)
- return; //avoid crash in case of misuse
+ return false; //avoid crash in case of misuse
if (length <= d->getDescriptorNumber())
- return; // see http://www.vdr-portal.de/board60-linux/board14-betriebssystem/board69-c-t-vdr/p1025777-segfault-mit-vdr-1-7-21/#post1025777
+ return false; // see http://www.vdr-portal.de/board60-linux/board14-betriebssystem/board69-c-t-vdr/p1025777-segfault-mit-vdr-1-7-21/#post1025777
array[d->getDescriptorNumber()]=d;
+ return true;
}
bool DescriptorGroup::isComplete() {
diff --git a/libsi/si.h b/libsi/si.h
index 1e65111f..7c6f0e3e 100644
--- a/libsi/si.h
+++ b/libsi/si.h
@@ -6,7 +6,7 @@
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
- * $Id: si.h 3.2 2014/02/08 14:11:32 kls Exp $
+ * $Id: si.h 3.3 2015/02/01 14:55:27 kls Exp $
* *
***************************************************************************/
@@ -483,7 +483,7 @@ class DescriptorGroup {
public:
DescriptorGroup(bool deleteOnDesctruction=true);
~DescriptorGroup();
- void Add(GroupDescriptor *d);
+ bool Add(GroupDescriptor *d);
void Delete();
int getLength() { return length; }
GroupDescriptor **getDescriptors() { return array; }