FIx memleak in save-thyself introduced by changing plugin_get_list to copy.

Original commit message from CVS:
FIx memleak in save-thyself introduced by changing plugin_get_list to
copy.
This commit is contained in:
Richard Boulton 2001-06-05 01:26:01 +00:00
parent 3eaff63dcf
commit b971f48169
3 changed files with 16 additions and 51 deletions

View file

@ -1,7 +1,11 @@
# This Makefile.am is a much neater Makefile.am for this directory, but
# depends on automake 1.4d or later.
# cheap trick to build . first... # cheap trick to build . first...
SUBDIRS = . types elements autoplug SUBDIRS = . types elements autoplug
lib_LTLIBRARIES = libgst.la lib_LTLIBRARIES = libgst.la
noinst_LTLIBRARIES = libcothreads.la
if HAVE_CPU_I386 if HAVE_CPU_I386
GSTARCH_SRCS = gstcpuid_i386.s GSTARCH_SRCS = gstcpuid_i386.s
@ -9,11 +13,15 @@ else
GSTARCH_SRCS = GSTARCH_SRCS =
endif endif
EXTRA_libgst_la_SOURCES = \ EXTRA_libgst_la_SOURCES = gstcpuid_i386.s
gstcpuid_i386.s
libcothreads_la_CFLAGS = $(CFLAGS) $(LIBGST_CFLAGS) -O2 -D_GNU_SOURCE
libgst_la_CFLAGS = $(CFLAGS) $(LIBGST_CFLAGS) -D_GNU_SOURCE
CFLAGS =
libcothreads_la_SOURCES = cothreads.c
libgst_la_SOURCES = \ libgst_la_SOURCES = \
cothreads.c \
gst.c \ gst.c \
gstautoplug.c \ gstautoplug.c \
gstbin.c \ gstbin.c \
@ -43,50 +51,6 @@ libgst_la_SOURCES = \
gstparse.c \ gstparse.c \
$(GSTARCH_SRCS) $(GSTARCH_SRCS)
##### Oh this sucks so badly. This isn't funny. #####
# the compiler shoots cothreads.c in the head at -O6
# FIXME: these manual rules break the dependency generation, so we have a
# nasty hack here.
#LTCOMPILE2=$(LTCOMPILE) -O2
#COMPILE2=$(COMPILE) -O2
# FIXME this only lists the x86 arch file, we really should merge them all
cothreads.lo: $(srcdir)/cothreads.c $(srcdir)/cothreads.h $(srcdir)/gst_private.h \
$(top_builddir)/config.h $(srcdir)/gstinfo.c $(srcdir)/gstarch.h $(srcdir)/gsti386.h
$(LIBTOOL) --mode=compile $(COMPILE) -O2 -c $<
cothreads.o: $(srcdir)/cothreads.c $(srcdir)/cothreads.h $(srcdir)/gst_private.h \
$(top_builddir)/config.h $(srcdir)/gstinfo.c $(srcdir)/gstarch.h $(srcdir)/gsti386.h
$(COMPILE) -O2 -c $<
# NOTDEPEND.cothreads.lo: cothreads.c
# NOTDEPEND $(LTCOMPILE2) -c $<
# NOTDEPEND.cothreads.o: cothreads.c
# NOTDEPEND $(COMPILE2) -c $<
#cothreads.lo: cothreads.c
# @echo '$(LTCOMPILE2) -c $<'; \
# $(LTCOMPILE2) -Wp,-MD,.deps/$(*F).pp -c $<
# @-sed -e 's/^\([^:]*\)\.o[ ]*:/\1.lo \1.o :/' \
# < .deps/$(*F).pp > .deps/$(*F).P; \
# tr ' ' '\012' < .deps/$(*F).pp \
# | sed -e 's/^\\$$//' -e '/^$$/ d' -e '/:$$/ d' -e 's/$$/ :/' \
# >> .deps/$(*F).P; \
# rm -f .deps/$(*F).pp
#cothreads.o: cothreads.c
# @echo '$(COMPILE2) -c $<'; \
# $(COMPILE2) -Wp,-MD,.deps/$(*F).pp -c $<
# @-sed -e 's/^\([^:]*\)\.o[ ]*:/\1.lo \1.o :/' \
# < .deps/$(*F).pp > .deps/$(*F).P; \
# tr ' ' '\012' < .deps/$(*F).pp \
# | sed -e 's/^\\$$//' -e '/^$$/ d' -e '/:$$/ d' -e 's/$$/ :/' \
# >> .deps/$(*F).P; \
# rm -f .deps/$(*F).pp
##### end immense suckage #####
libgstincludedir = $(includedir)/gst libgstincludedir = $(includedir)/gst
libgstinclude_HEADERS = \ libgstinclude_HEADERS = \
cothreads.h \ cothreads.h \
@ -130,8 +94,7 @@ noinst_HEADERS = \
gstsparc.h \ gstsparc.h \
gstpropsprivate.h gstpropsprivate.h
CFLAGS = $(LIBGST_CFLAGS) -D_GNU_SOURCE libgst_la_LDFLAGS = -version-info $(GST_LIBVERSION) $(LIBGST_LIBS)
LIBS = $(LIBGST_LIBS) libgst_la_LIBADD = libcothreads.la
libgst_la_LDFLAGS = -version-info $(GST_LIBVERSION)
EXTRA_DIST = ROADMAP EXTRA_DIST = ROADMAP

View file

@ -158,6 +158,7 @@ gst_elementfactory_create (GstElementFactory *factory,
g_return_val_if_fail(factory != NULL, NULL); g_return_val_if_fail(factory != NULL, NULL);
g_return_val_if_fail(factory->type != 0, NULL); g_return_val_if_fail(factory->type != 0, NULL);
GST_DEBUG (GST_CAT_ELEMENTFACTORY,"factory->type is \"%d\"\n", factory->type);
// create an instance of the element // create an instance of the element
element = GST_ELEMENT(gtk_type_new(factory->type)); element = GST_ELEMENT(gtk_type_new(factory->type));
g_assert(element != NULL); g_assert(element != NULL);

View file

@ -849,7 +849,7 @@ gst_plugin_save_thyself (xmlNodePtr parent)
xmlNodePtr tree, subtree; xmlNodePtr tree, subtree;
GList *plugins = NULL, *elements = NULL, *types = NULL, *autopluggers = NULL; GList *plugins = NULL, *elements = NULL, *types = NULL, *autopluggers = NULL;
plugins = gst_plugin_get_list (); plugins = g_list_copy (_gst_plugins);
while (plugins) { while (plugins) {
GstPlugin *plugin = (GstPlugin *)plugins->data; GstPlugin *plugin = (GstPlugin *)plugins->data;
@ -887,6 +887,7 @@ gst_plugin_save_thyself (xmlNodePtr parent)
} }
plugins = g_list_next (plugins); plugins = g_list_next (plugins);
} }
g_list_free (plugins);
return parent; return parent;
} }