AW: [vdr] *** glibc detected *** double free or corruption 1.4.2-1 Patch
Commit Message
martin wrote:
> just to let you know: the patch you attached here, did not solve the
> problem! My VDR crashed again.
Just a few minutes too late...
The patch had another bug that re-introduced the original problem once
again. The new copy constructor did not initialize the aux pointer, and
the assign operator consequently free'd its uninitialized value - and
with some luck, thats a valid pointer.
The attached patch does the missing initialization. Hopefully, thats the
last bug. ;)
Cheers,
Udo
Comments
Udo Richter wrote:
> martin wrote:
>> just to let you know: the patch you attached here, did not solve the
>> problem! My VDR crashed again.
>
> Just a few minutes too late...
>
> The patch had another bug that re-introduced the original problem once
> again. The new copy constructor did not initialize the aux pointer, and
> the assign operator consequently free'd its uninitialized value - and
> with some luck, thats a valid pointer.
>
> The attached patch does the missing initialization. Hopefully, thats the
> last bug. ;)
That'll teach me not to write code when I'm on my way out to the
"Biergarten"... ;-)
Thanks.
Klaus
Okay, vdr-1.4.2.1-timerassign-2.diff did work :-) Thanks Udo and Klaus for
coding!
So, I'm happy now and can relax on my balcony with a Weißbier :-)
Greetz from Munich,
Martin
-----Ursprüngliche Nachricht-----
Von: vdr-bounces@linuxtv.org [mailto:vdr-bounces@linuxtv.org] Im Auftrag von
Klaus Schmidinger
Gesendet: Montag, 4. September 2006 22:25
An: vdr@linuxtv.org
Betreff: Re: AW: [vdr] *** glibc detected *** double free or corruption
1.4.2-1 Patch
Udo Richter wrote:
> martin wrote:
>> just to let you know: the patch you attached here, did not solve the
>> problem! My VDR crashed again.
>
> Just a few minutes too late...
>
> The patch had another bug that re-introduced the original problem once
> again. The new copy constructor did not initialize the aux pointer,
> and the assign operator consequently free'd its uninitialized value -
> and with some luck, thats a valid pointer.
>
> The attached patch does the missing initialization. Hopefully, thats
> the last bug. ;)
That'll teach me not to write code when I'm on my way out to the
"Biergarten"... ;-)
Thanks.
Klaus
Klaus Schmidinger wrote:
> That'll teach me not to write code when I'm on my way out to the
> "Biergarten"... ;-)
Next time, do it afterwards. Afterwards, code is much more 'fluently'. ;)
Cheers,
Udo
@@ -83,6 +83,16 @@
event = NULL; // let SetEvent() be called to get a log message
}
+cTimer::cTimer(const cTimer &Timer)
+{
+ // initialize at least the pointers
+ channel = NULL;
+ aux = NULL;
+ event = NULL;
+ // assign operator does the rest
+ *this = Timer;
+}
+
cTimer::~cTimer()
{
free(aux);
@@ -90,24 +100,26 @@
cTimer& cTimer::operator= (const cTimer &Timer)
{
- startTime = Timer.startTime;
- stopTime = Timer.stopTime;
- lastSetEvent = 0;
- recording = Timer.recording;
- pending = Timer.pending;
- inVpsMargin = Timer.inVpsMargin;
- flags = Timer.flags;
- channel = Timer.channel;
- day = Timer.day;
- weekdays = Timer.weekdays;
- start = Timer.start;
- stop = Timer.stop;
- priority = Timer.priority;
- lifetime = Timer.lifetime;
- strncpy(file, Timer.file, sizeof(file));
- free(aux);
- aux = Timer.aux ? strdup(Timer.aux) : NULL;
- event = NULL;
+ if (&Timer != this) {
+ startTime = Timer.startTime;
+ stopTime = Timer.stopTime;
+ lastSetEvent = 0;
+ recording = Timer.recording;
+ pending = Timer.pending;
+ inVpsMargin = Timer.inVpsMargin;
+ flags = Timer.flags;
+ channel = Timer.channel;
+ day = Timer.day;
+ weekdays = Timer.weekdays;
+ start = Timer.start;
+ stop = Timer.stop;
+ priority = Timer.priority;
+ lifetime = Timer.lifetime;
+ strncpy(file, Timer.file, sizeof(file));
+ free(aux);
+ aux = Timer.aux ? strdup(Timer.aux) : NULL;
+ event = NULL;
+ }
return *this;
}
@@ -44,6 +44,7 @@
public:
cTimer(bool Instant = false, bool Pause = false, cChannel *Channel = NULL);
cTimer(const cEvent *Event);
+ cTimer(const cTimer &Timer);
virtual ~cTimer();
cTimer& operator= (const cTimer &Timer);
virtual int Compare(const cListObject &ListObject) const;