shithub: aubio

Download patch

ref: be63940f0a2c68d13c653f31a9feda95e42c2dc2
parent: 4b9481f974ca00a27aff49e15cbcdca02de676c6
author: Paul Brossier <piem@piem.org>
date: Wed Dec 12 10:27:57 EST 2018

[io] avoid memory leak in sink_vorbis

--- a/src/io/sink_vorbis.c
+++ b/src/io/sink_vorbis.c
@@ -62,7 +62,7 @@
 
   s->path = AUBIO_ARRAY(char_t, strnlen(uri, PATH_MAX) + 1);
   strncpy(s->path, uri, strnlen(uri, PATH_MAX) + 1);
-  s->path[PATH_MAX - 1] = '\0';
+  s->path[strnlen(uri, PATH_MAX)] = '\0';
 
   s->channels = 0;
 
@@ -92,6 +92,7 @@
   vorbis_comment_clear(&s->vc);
   vorbis_info_clear(&s->vi);
 
+  if (s->path) AUBIO_FREE(s->path);
   AUBIO_FREE(s);
 }