From 7b0e6f3e62f052d46fc9b46d3adf2483335518be Mon Sep 17 00:00:00 2001 From: Ondřej Hruška Date: Sun, 22 Mar 2020 09:47:35 +0100 Subject: gstdatetime: Add missing NULL check to gst_date_time_new_local_time Also add a unit test for this. Fixes #524 --- gst/gstdatetime.c | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'gst/gstdatetime.c') diff --git a/gst/gstdatetime.c b/gst/gstdatetime.c index 6d6e7c855d..2cea67169e 100644 --- a/gst/gstdatetime.c +++ b/gst/gstdatetime.c @@ -520,6 +520,9 @@ gst_date_time_new_local_time (gint year, gint month, gint day, gint hour, datetime = gst_date_time_new_from_g_date_time (g_date_time_new_local (year, month, day, hour, minute, seconds)); + if (datetime == NULL) + return NULL; + datetime->fields = fields; return datetime; } @@ -644,6 +647,9 @@ gst_date_time_new (gfloat tzoffset, gint year, gint month, gint day, gint hour, dt = g_date_time_new (tz, year, month, day, hour, minute, seconds); g_time_zone_unref (tz); + if (!dt) + return NULL; /* date failed validation */ + datetime = gst_date_time_new_from_g_date_time (dt); datetime->fields = fields; -- cgit v1.2.3-70-g09d2