summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuis de Bethencourt <luis.bg@samsung.com>2014-10-29 18:18:07 +0000
committerTim-Philipp Müller <tim@centricular.com>2014-11-03 00:16:04 +0000
commit7d976bab1f0d2482bfdd196de931d56cab180da7 (patch)
tree946a94be1c7ff61cd10d9cdc49173eccfce4b8aa
parentc514f0514a53554533ee89ad4a28ee2fa6f6c092 (diff)
downloadgstreamer-plugins-bad-7d976bab1f0d2482bfdd196de931d56cab180da7.tar.gz
glshader: Fix memory leak
Memory is only freed in the TRUE clause of the if conditional. Free in the else clause as well. Also, consolidate g_malloc + sprintf into a g_strdup_printf(). CID #1212171 https://bugzilla.gnome.org/show_bug.cgi?id=739368
-rw-r--r--gst-libs/gst/gl/gstglshadervariables.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/gst-libs/gst/gl/gstglshadervariables.c b/gst-libs/gst/gl/gstglshadervariables.c
index 325a71f2d..4ca2efe71 100644
--- a/gst-libs/gst/gl/gstglshadervariables.c
+++ b/gst-libs/gst/gl/gstglshadervariables.c
@@ -254,12 +254,12 @@ gst_gl_shadervariables_parse (GstGLShader * shader, char *variables,
trimright (t, " \t");
if (arraysize) {
- char *s = g_malloc (strlen (vartype) + 32);
- sprintf (s, "%s[%d]", vartype, arraysize);
+ gchar *s = g_strdup_printf ("%s[%d]", vartype, arraysize);
if (strcmp (t, s)) {
g_free (s);
goto parse_error;
}
+ g_free (s);
} else {
if (strcmp (t, vartype))
goto parse_error;