[vorbis-dev] Vorbis memory leak....

oddsock oddsock at oddsock.org
Sat Sep 1 14:12:50 PDT 2001



I have found a memory leak in vorbis.

it's in the following line of psy.c :

p->noisethresh=_ogg_malloc(n*sizeof(float));

this pointer is apparently not being freed..it's leaking 2 4196 block + 1
512  block every time I initialize the encoder...

the following addition to psy.c will fix this leak :

void _vp_psy_clear(vorbis_look_psy *p){
  int i,j;
  if(p){
    if(p->ath)_ogg_free(p->ath);
    if(p->octave)_ogg_free(p->octave);
    if(p->bark)_ogg_free(p->bark);
    if(p->tonecurves){
      for(i=0;i<P_BANDS;i++){
 for(j=0;j<P_LEVELS;j++){
   _ogg_free(p->tonecurves[i][j]);
 }
 _ogg_free(p->tonecurves[i]);
      }
      _ogg_free(p->tonecurves);
        _ogg_free(p->noisethresh);  // FIXED LEAK by oddsock
      _ogg_free(p->noiseoffset);
    }
    memset(p,0,sizeof(vorbis_look_psy));
  }
}

/me waits for his t-shirt.... :)

oddsock

--- >8 ----
List archives:  http://www.xiph.org/archives/
Ogg project homepage: http://www.xiph.org/ogg/
To unsubscribe from this list, send a message to 'vorbis-dev-request at xiph.org'
containing only the word 'unsubscribe' in the body.  No subject is needed.
Unsubscribe messages sent to the list will be ignored/filtered.



More information about the Vorbis-dev mailing list