From 56fc2986d554b93d16fa1151765a9987bc42e4da Mon Sep 17 00:00:00 2001 From: Tom St Denis Date: Tue, 3 Nov 2015 12:41:54 -0500 Subject: st/omx: Avoid segfault in deconstructor if constructor fails MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit If the constructor fails before the LIST_INIT calls the pointers will be null and the deconstructor will segfault. Signed-off-by: Tom St Denis Reviewed-by: Leo Liu Reviewed-by: Christian König --- src/gallium/state_trackers/omx/vid_enc.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src/gallium/state_trackers') diff --git a/src/gallium/state_trackers/omx/vid_enc.c b/src/gallium/state_trackers/omx/vid_enc.c index aa45089ae04..df22a97a42c 100644 --- a/src/gallium/state_trackers/omx/vid_enc.c +++ b/src/gallium/state_trackers/omx/vid_enc.c @@ -869,6 +869,9 @@ static void enc_ReleaseTasks(struct list_head *head) { struct encode_task *i, *next; + if (!head) + return; + LIST_FOR_EACH_ENTRY_SAFE(i, next, head, list) { pipe_resource_reference(&i->bitstream, NULL); i->buf->destroy(i->buf); -- cgit v1.2.3