AW: [vdr] *** glibc detected *** double free or corruption 1.4.2-1
Patch
Klaus Schmidinger
Klaus.Schmidinger at cadsoft.de
Mon Sep 4 18:43:53 CEST 2006
martin wrote:
> Hi,
>
> implemented the following, but it did not solve the issue :-(
>
>
> timers.c
>
> cTimer::~cTimer()
> {
> if(aux) free(aux);
> }
>
> ..
>
> lifetime = Timer.lifetime;
> strncpy(file, Timer.file, sizeof(file));
> if (aux) free(aux);
> aux = Timer.aux ? strdup(Timer.aux) : NULL;
>
>
> Klaus's debugging statements did not work, as gcc refuses work ..
Sorry, that was a typo - I was in a hurry ;-)
It needs to be fprintf().
Anyway, Alexander Rieger just sent me a PM in which he noted that
the operator=() function needs to check whether this is an assignment
to "self".
Please try this:
Timer& cTimer::operator= (const cTimer &Timer)
{
if (this != &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;
}
return *this;
}
Klaus
More information about the vdr
mailing list