Fixed memory leak in queue.

Original commit message from CVS:
Fixed memory leak in queue.
This commit is contained in:
Wim Taymans 2000-02-16 23:27:45 +00:00
parent b797f15e3a
commit 4660e95926
7 changed files with 14 additions and 7 deletions

View file

@ -198,6 +198,7 @@ void gst_queue_push(GstConnection *connection) {
buf = (GstBuffer *)(front->data);
queue->queue = g_list_remove_link(queue->queue,front);
gst_pad_push(queue->srcpad,buf);
g_list_free(front);
queue->level_buffers--;
// g_print("-");

View file

@ -124,10 +124,12 @@ void gst_buffer_destroy(GstBuffer *buffer) {
g_return_if_fail(buffer != NULL);
if (buffer->parent != NULL)
if (buffer->parent != NULL) {
DEBUG("BUF: freeing subbuffer %p\n",buffer);
else
}
else {
DEBUG("BUF: freeing buffer %p\n",buffer);
}
// free the data only if there is some, DONTFREE isn't set, and not sub
if (GST_BUFFER_DATA(buffer) &&
@ -162,7 +164,7 @@ void gst_buffer_ref(GstBuffer *buffer) {
DEBUG("BUF: referencing buffer %p\n",buffer);
#ifdef HAVE_ATOMIC_H
g_return_if_fail(atomic_read(&(buffer->refcount)) > 0);
//g_return_if_fail(atomic_read(&(buffer->refcount)) > 0);
atomic_inc(&(buffer->refcount))
#else
g_return_if_fail(buffer->refcount > 0);

View file

@ -200,7 +200,7 @@ gboolean gst_plugin_load_absolute(gchar *name) {
* Returns: new plugin
*/
GstPlugin *gst_plugin_new(gchar *name) {
GstPlugin *plugin = (GstPlugin *)malloc(sizeof(GstPlugin));
GstPlugin *plugin = (GstPlugin *)g_malloc(sizeof(GstPlugin));
plugin->name = g_strdup(name);
plugin->longname = NULL;

View file

@ -49,7 +49,7 @@ guint16 gst_type_register(GstTypeFactory *factory) {
// id = gst_type_find_by_mime(factory->mime);
id = 0;
if (!id) {
type = (GstType *)malloc(sizeof(GstType));
type = (GstType *)g_malloc(sizeof(GstType));
type->id = _gst_maxtype++;
type->mime = factory->mime;

View file

@ -198,6 +198,7 @@ void gst_queue_push(GstConnection *connection) {
buf = (GstBuffer *)(front->data);
queue->queue = g_list_remove_link(queue->queue,front);
gst_pad_push(queue->srcpad,buf);
g_list_free(front);
queue->level_buffers--;
// g_print("-");

View file

@ -144,6 +144,8 @@ int main(int argc,char *argv[]) {
xmlSaveFile("mp1parse.xml",gst_xml_write(GST_ELEMENT(pipeline)));
g_print("about to enter loop\n");
while (1)
while (1) {
gst_src_push(GST_SRC(src));
}
}

View file

@ -62,6 +62,7 @@ int main(int argc,char *argv[]) {
gst_element_set_state(GST_ELEMENT(pipeline),GST_STATE_RUNNING);
g_print("about to enter loop\n");
while (1)
while (1) {
gst_src_push(GST_SRC(src));
}
}