check: Don't leak test string

Turns out the length returned by `__gst_vasprintf()` doesn't include the final
`\0`.

CID #1455430

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/472>
This commit is contained in:
Edward Hervey 2020-05-08 06:49:45 +02:00 committed by Edward Hervey
parent cab5b22f21
commit 78b0baa7c9

View file

@ -44,7 +44,9 @@ test_printf (const char *format, ...)
len = __gst_vasprintf (&str, format, varargs); len = __gst_vasprintf (&str, format, varargs);
va_end (varargs); va_end (varargs);
if (len <= 0) /* The length doesn't include the final `\0`, so if it's >= 0 it's allocated
* and non-NULL */
if (len < 0)
return NULL; return NULL;
GST_INFO ("[%s]", str); GST_INFO ("[%s]", str);