mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-09-30 07:42:32 +00:00
fuzzing: Fix leak due to wrong initialization
We were registering plugins again and again and again ...
This commit is contained in:
parent
39ce1f76a4
commit
8f4bcce46e
2 changed files with 6 additions and 2 deletions
|
@ -88,7 +88,7 @@ int LLVMFuzzerTestOneInput(const guint8 *data, size_t size)
|
||||||
GstDiscoverer *dc;
|
GstDiscoverer *dc;
|
||||||
gint timeout = 10;
|
gint timeout = 10;
|
||||||
GstDiscovererInfo *info;
|
GstDiscovererInfo *info;
|
||||||
static gboolean initialized = 0;
|
static gboolean initialized = FALSE;
|
||||||
|
|
||||||
if (!initialized) {
|
if (!initialized) {
|
||||||
/* We want critical warnings to assert so we can fix them */
|
/* 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(ogg);
|
||||||
GST_PLUGIN_STATIC_REGISTER(theora);
|
GST_PLUGIN_STATIC_REGISTER(theora);
|
||||||
GST_PLUGIN_STATIC_REGISTER(vorbis);
|
GST_PLUGIN_STATIC_REGISTER(vorbis);
|
||||||
|
|
||||||
|
initialized = TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
dc = gst_discoverer_new (timeout * GST_SECOND, &err);
|
dc = gst_discoverer_new (timeout * GST_SECOND, &err);
|
||||||
|
|
|
@ -59,7 +59,7 @@ int
|
||||||
LLVMFuzzerTestOneInput (const guint8 * data, size_t size)
|
LLVMFuzzerTestOneInput (const guint8 * data, size_t size)
|
||||||
{
|
{
|
||||||
GError *err = NULL;
|
GError *err = NULL;
|
||||||
static gboolean initialized = 0;
|
static gboolean initialized = FALSE;
|
||||||
GstElement *pipeline, *source, *typefind, *fakesink;
|
GstElement *pipeline, *source, *typefind, *fakesink;
|
||||||
GstBuffer *buf;
|
GstBuffer *buf;
|
||||||
GstFlowReturn flowret;
|
GstFlowReturn flowret;
|
||||||
|
@ -76,6 +76,8 @@ LLVMFuzzerTestOneInput (const guint8 * data, size_t size)
|
||||||
GST_PLUGIN_STATIC_REGISTER (coreelements);
|
GST_PLUGIN_STATIC_REGISTER (coreelements);
|
||||||
GST_PLUGIN_STATIC_REGISTER (typefindfunctions);
|
GST_PLUGIN_STATIC_REGISTER (typefindfunctions);
|
||||||
GST_PLUGIN_STATIC_REGISTER (app);
|
GST_PLUGIN_STATIC_REGISTER (app);
|
||||||
|
|
||||||
|
initialized = TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Create the pipeline */
|
/* Create the pipeline */
|
||||||
|
|
Loading…
Reference in a new issue