AW: *** glibc detected *** double free or corruption 1.4.2-1 Patch

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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


[Index of Archives]     [Linux Media]     [Asterisk]     [DCCP]     [Netdev]     [Xorg]     [Util Linux NG]     [Xfree86]     [Big List of Linux Books]     [Fedora Users]     [Fedora Women]     [ALSA Devel]     [Linux USB]

  Powered by Linux