From ad5aec99ffeeb6a3e2472147c79b7c6487a526b8 Mon Sep 17 00:00:00 2001 From: Palana Date: Tue, 18 Aug 2015 20:00:10 +0200 Subject: [PATCH] libobs: Fix obs_data crash Accessing objects inside obs_datas after obs_data_clear was called on the parent obs_data causes a NULL dereference. Reproduce with: obs_data_t *data = obs_data_create(); obs_data_set_obj(data, "foo", NULL); obs_data_clear(data); obs_data_get_obj(data, "foo"); --- libobs/obs-data.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/libobs/obs-data.c b/libobs/obs-data.c index 6045d6f5c..347515ffd 100644 --- a/libobs/obs-data.c +++ b/libobs/obs-data.c @@ -131,7 +131,11 @@ static inline obs_data_t *get_item_obj(struct obs_data_item *item) if (!item) return NULL; - return *(obs_data_t**)get_item_data(item); + obs_data_t **data = get_item_data(item); + if (!data) + return NULL; + + return *data; } static inline obs_data_t *get_item_default_obj(struct obs_data_item *item)