mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-02-17 11:45:25 +00:00
test: fix leak in video overlay composition unit test
gst_buffer_set_qdata() will leak the structure passed to it when called incorrectly (e.g. on a non-metadata-writable buffer). This is expected, but we must avoid doing that in valgrind.
This commit is contained in:
parent
35a17ac152
commit
3242f55861
2 changed files with 12 additions and 2 deletions
|
@ -1259,6 +1259,7 @@ G_STMT_START { \
|
|||
ret = v0 + (v1 * (255 - alpha)) / 255; \
|
||||
} G_STMT_END
|
||||
|
||||
/* returns newly-allocated pixels in src->pixels, which caller must g_free() */
|
||||
void
|
||||
video_blend_scale_linear_RGBA (GstBlendVideoFormatInfo * src,
|
||||
gint dest_height, gint dest_width)
|
||||
|
|
|
@ -25,6 +25,10 @@
|
|||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_VALGRIND
|
||||
# include <valgrind/valgrind.h>
|
||||
#endif
|
||||
|
||||
#include <unistd.h>
|
||||
|
||||
#include <gst/check/gstcheck.h>
|
||||
|
@ -905,8 +909,13 @@ GST_START_TEST (test_overlay_composition)
|
|||
fail_unless (gst_video_buffer_get_overlay_composition (buf) == NULL);
|
||||
|
||||
gst_buffer_ref (buf);
|
||||
/* buffer now has refcount of 2, so its metadata is not writable */
|
||||
ASSERT_CRITICAL (gst_video_buffer_set_overlay_composition (buf, comp1));
|
||||
/* buffer now has refcount of 2, so its metadata is not writable.
|
||||
* only check this if we are not running in valgrind, as it leaks */
|
||||
#ifdef HAVE_VALGRIND
|
||||
if (!RUNNING_ON_VALGRIND) {
|
||||
ASSERT_CRITICAL (gst_video_buffer_set_overlay_composition (buf, comp1));
|
||||
}
|
||||
#endif
|
||||
gst_buffer_unref (buf);
|
||||
gst_video_buffer_set_overlay_composition (buf, comp1);
|
||||
fail_unless (gst_video_buffer_get_overlay_composition (buf) == comp1);
|
||||
|
|
Loading…
Reference in a new issue