From 627a9567687f87ed2685f5ed8e625385b9ee75d9 Mon Sep 17 00:00:00 2001 From: Jan Schmidt Date: Tue, 15 Aug 2023 14:23:22 +1000 Subject: [PATCH] python: Fix python plugins that implement URIHandler Ensure the generated URI strv list is NULL terminated in the python binding Part-of: --- subprojects/gst-python/gi/overrides/gstmodule.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/subprojects/gst-python/gi/overrides/gstmodule.c b/subprojects/gst-python/gi/overrides/gstmodule.c index da52cd57ec..80a84c5b0c 100644 --- a/subprojects/gst-python/gi/overrides/gstmodule.c +++ b/subprojects/gst-python/gi/overrides/gstmodule.c @@ -1131,11 +1131,11 @@ py_uri_handler_get_protocols_from_pyobject (PyObject * protocols) len = PyTuple_Size (protocols); if (len == 0) { PyErr_Format (PyExc_TypeError, - "Empty tuple for GstUriHandler.__protocols"); + "Empty tuple for GstUriHandler.__protocols__"); goto err; } - res = g_malloc (len * sizeof (gchar *)); + res = g_malloc0 ((len + 1) * sizeof (gchar *)); for (i = 0; i < len; i++) { PyObject *protocol = (PyObject *) PyTuple_GetItem (protocols, i); @@ -1147,8 +1147,8 @@ py_uri_handler_get_protocols_from_pyobject (PyObject * protocols) res[i] = g_strdup (PyUnicode_AsUTF8 (protocol)); } } else { - PyErr_Format (PyExc_TypeError, "invalid type for GstUriHandler.__protocols." - " Should be a tuple"); + PyErr_Format (PyExc_TypeError, + "invalid type for GstUriHandler.__protocols__" " Should be a tuple"); goto err; }