From 8f4bcce46ea7fdfcb3e2a9750f34252e34c39860 Mon Sep 17 00:00:00 2001 From: Edward Hervey Date: Wed, 1 Nov 2017 14:10:05 +0100 Subject: [PATCH] fuzzing: Fix leak due to wrong initialization We were registering plugins again and again and again ... --- fuzzing/gst-discoverer.c | 4 +++- fuzzing/typefind.c | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/fuzzing/gst-discoverer.c b/fuzzing/gst-discoverer.c index 17ed7d44d3..519537a61b 100644 --- a/fuzzing/gst-discoverer.c +++ b/fuzzing/gst-discoverer.c @@ -88,7 +88,7 @@ int LLVMFuzzerTestOneInput(const guint8 *data, size_t size) GstDiscoverer *dc; gint timeout = 10; GstDiscovererInfo *info; - static gboolean initialized = 0; + static gboolean initialized = FALSE; if (!initialized) { /* We want critical warnings to assert so we can fix them */ @@ -105,6 +105,8 @@ int LLVMFuzzerTestOneInput(const guint8 *data, size_t size) GST_PLUGIN_STATIC_REGISTER(ogg); GST_PLUGIN_STATIC_REGISTER(theora); GST_PLUGIN_STATIC_REGISTER(vorbis); + + initialized = TRUE; } dc = gst_discoverer_new (timeout * GST_SECOND, &err); diff --git a/fuzzing/typefind.c b/fuzzing/typefind.c index 70f1a3813f..16615ef130 100644 --- a/fuzzing/typefind.c +++ b/fuzzing/typefind.c @@ -59,7 +59,7 @@ int LLVMFuzzerTestOneInput (const guint8 * data, size_t size) { GError *err = NULL; - static gboolean initialized = 0; + static gboolean initialized = FALSE; GstElement *pipeline, *source, *typefind, *fakesink; GstBuffer *buf; GstFlowReturn flowret; @@ -76,6 +76,8 @@ LLVMFuzzerTestOneInput (const guint8 * data, size_t size) GST_PLUGIN_STATIC_REGISTER (coreelements); GST_PLUGIN_STATIC_REGISTER (typefindfunctions); GST_PLUGIN_STATIC_REGISTER (app); + + initialized = TRUE; } /* Create the pipeline */