2005-05-25 Wim Taymans <wim@fluendo.com>
+ * ext/gnomevfs/gstgnomevfssrc.c: (gst_gnomevfssrc_create):
+ Fix memleaks, GST_BUFFER_DATA() is not freed.
+
+2005-05-25 Wim Taymans <wim@fluendo.com>
+
* ext/alsa/gstalsasink.c: (gst_alsasink_open):
Open non-blocking, set to blocking mode afterwards to avoid
lockups when audio device is busy.
}
}
- /* create the buffer */
- buf = gst_buffer_new ();
-
audiocast_do_notifications (src);
if (src->iradio_mode && src->icy_metaint > 0) {
- data = g_malloc (src->icy_metaint);
+ buf = gst_buffer_new_and_alloc (src->icy_metaint);
+
+ data = GST_BUFFER_DATA (buf);
/* try to read */
GST_DEBUG ("doing read: icy_count: %" G_GINT64_FORMAT, src->icy_count);
src->icy_count += readbytes;
GST_BUFFER_OFFSET (buf) = src->curoffset;
- GST_BUFFER_SIZE (buf) += readbytes;
- GST_BUFFER_DATA (buf) = data;
+ GST_BUFFER_SIZE (buf) = readbytes;
src->curoffset += readbytes;
if (src->icy_count == src->icy_metaint) {
src->icy_count = 0;
}
} else {
- data = g_malloc (size);
+ buf = gst_buffer_new_and_alloc (size);
+
+ data = GST_BUFFER_DATA (buf);
+ GST_BUFFER_OFFSET (buf) = src->curoffset;
res = gnome_vfs_read (src->handle, data, size, &readbytes);
+ GST_BUFFER_SIZE (buf) = readbytes;
+
if (res != GNOME_VFS_OK)
goto read_failed;
if (readbytes == 0)
goto eos;
- GST_BUFFER_OFFSET (buf) = src->curoffset;
- GST_BUFFER_SIZE (buf) = readbytes;
- GST_BUFFER_DATA (buf) = data;
-
src->curoffset += readbytes;
}