Skip to content
GitLab
  • Menu
Projects Groups Snippets
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • T Tremor
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 6
    • Issues 6
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 0
    • Merge requests 0
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages & Registries
    • Packages & Registries
    • Container Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • Xiph.Org
  • Tremor
  • Issues
  • #1127
Closed
Open
Created Feb 05, 2007 by Gitlab Bot@GitlabBotDeveloper

Possible memory leaks in Tremor

I found Tremor has possible memory leaks, and tried to fix it. Following changes seems to fix it, but I haven't analyzed Tremor completely. Please check it before committing.

 int ogg_stream_destroy(ogg_stream_state *os){
   if(os){
     ogg_buffer_release(os->header_tail);
     ogg_buffer_release(os->body_tail);
-    memset(os,0,sizeof(*os));
+    _ogg_free( os );
   }
   return OGG_SUCCESS;
 } 

 /* call the helper while holding lock */
 static void _ogg_buffer_destroy(ogg_buffer_state *bs){
   ogg_buffer *bt;
   ogg_reference *rt;
-  if(bs->shutdown){
+  if(bs->shutdown && !bs->outstanding){
     bt=bs->unused_buffers;
     rt=bs->unused_references;
-    if(!bs->outstanding){
-      _ogg_free(bs);
-      return;
-    }
     while(bt){
       ogg_buffer *b=bt;
       bt=b->ptr.next;
       if(b->data)_ogg_free(b->data);
       _ogg_free(b);
     }
     bs->unused_buffers=0;
     while(rt){
       ogg_reference *r=rt;
       rt=r->next;
       _ogg_free(r);
     }
     bs->unused_references=0;
+    _ogg_free(bs);
   }
 }
Assignee
Assign to
Time tracking