From c8cf714d371eac31ce444632510c0686ce6b17a5 Mon Sep 17 00:00:00 2001 From: Jan Schmidt Date: Sat, 1 Oct 2022 04:47:31 +1000 Subject: [PATCH] xvimagesink: Don't leak temporary Use a stack variable instead of a temporarily malloced variable that wasn't being freed properly. Fixes a small leak of a GstXvTouchDevice Part-of: --- subprojects/gst-plugins-base/sys/xvimage/xvcontext.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/subprojects/gst-plugins-base/sys/xvimage/xvcontext.c b/subprojects/gst-plugins-base/sys/xvimage/xvcontext.c index a67194c..8579709 100644 --- a/subprojects/gst-plugins-base/sys/xvimage/xvcontext.c +++ b/subprojects/gst-plugins-base/sys/xvimage/xvcontext.c @@ -1141,7 +1141,7 @@ gst_xwindow_select_touch_events (GstXvContext * context, GstXWindow * window) /* Find suitable touch screen devices, and select touch events for each */ for (i = 0; i < ndevices; i++) { XIEventMask mask_data; - GstXvTouchDevice temp, *device; + GstXvTouchDevice temp; gboolean has_touch = FALSE; if (devices[i].use != XISlavePointer) @@ -1186,11 +1186,11 @@ gst_xwindow_select_touch_events (GstXvContext * context, GstXWindow * window) "pressure-sensitive (abs)" : "pressure-sensitive (rel)"), temp.id, temp.name); - device = g_new (GstXvTouchDevice, 1); - *device = temp; - device->name = g_strdup (device->name); + GstXvTouchDevice device = temp; + device.name = g_strdup (temp.name); + window->touch_devices = - g_array_append_vals (window->touch_devices, device, 1); + g_array_append_val (window->touch_devices, device); mask_data.deviceid = temp.id; mask_data.mask_len = mask_len; -- 2.7.4