summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJan Schmidt <jan@centricular.com>2020-10-30 00:30:52 +1100
committerTim-Philipp Müller <tim@centricular.com>2020-11-20 20:39:52 +0000
commit2e09276affcea1073a862686c71f94cabb3d099a (patch)
treedefb7e3f763906287b80566829936e010148d73f
parent35540038a00fa3bfa0a81305cef086f34c5ee964 (diff)
init: Fix initialisation crash
Fix a case where initialisation fails without setting the passed-in GError and the caller assumes it will be set, and add a guard to catch the condition in case it happens again in the future. Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-editing-services/-/merge_requests/218>
-rw-r--r--ges/ges.c3
-rw-r--r--tools/ges-launcher.c8
2 files changed, 9 insertions, 2 deletions
diff --git a/ges/ges.c b/ges/ges.c
index 8ff76b03..da465322 100644
--- a/ges/ges.c
+++ b/ges/ges.c
@@ -120,6 +120,9 @@ ges_init_post (GOptionContext * context, GOptionGroup * group, gpointer data,
_init_formatter_assets ();
if (!_ges_uri_asset_ensure_setup (uriasset_klass)) {
GST_ERROR ("cannot setup uri asset");
+ if (error)
+ *error = g_error_new (GST_CORE_ERROR, GST_CORE_ERROR_MISSING_PLUGIN,
+ "Cannot initialize URI asset class.");
goto failed;
}
diff --git a/tools/ges-launcher.c b/tools/ges-launcher.c
index 0e01c72a..92bc5b05 100644
--- a/tools/ges-launcher.c
+++ b/tools/ges-launcher.c
@@ -1051,9 +1051,13 @@ _local_command_line (GApplication * application, gchar ** arguments[],
gst_init (&argc, arguments);
if (!ges_launcher_parse_options (self, arguments, &argc, ctx, &error)) {
gst_init (NULL, NULL);
- ges_printerr ("Error initializing: %s\n", error->message);
g_option_context_free (ctx);
- g_error_free (error);
+ if (error) {
+ ges_printerr ("Error initializing: %s\n", error->message);
+ g_error_free (error);
+ } else {
+ ges_printerr ("Error parsing command line arguments\n");
+ }
*exit_status = 1;
goto done;
}