From: Tom St Denis Date: Tue, 3 Nov 2015 17:41:54 +0000 (-0500) Subject: st/omx: Avoid segfault in deconstructor if constructor fails X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=56fc2986d554b93d16fa1151765a9987bc42e4da;p=mesa.git st/omx: Avoid segfault in deconstructor if constructor fails 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 --- 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);