[flac-dev] Memory leaks

lvqcl lvqcl.mail at gmail.com
Sat Jul 4 10:13:55 PDT 2015


lvqcl wrote:

> If realloc fails, then the previous value of pointer x is lost and we have
> memory leak. The simplest fix is to add new functions like this:
>
>      static inline void *realloc_noleak_(void *ptr, size_t size)


Actually it won't fix this code in FLAC__metadata_object_vorbiscomment_resize_comments():

     else if(0 == (object->data.vorbis_comment.comments = realloc(object->data.vorbis_comment.comments, new_size)))
         return false;

because memory from object->data.vorbis_comment.comments[i].entry will leak.


More information about the flac-dev mailing list