st/omx: Avoid segfault in deconstructor if constructor fails
authorTom St Denis <tom.stdenis@amd.com>
Tue, 3 Nov 2015 17:41:54 +0000 (12:41 -0500)
committerMarek Olšák <marek.olsak@amd.com>
Tue, 12 Jan 2016 18:13:19 +0000 (19:13 +0100)
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 <tom.stdenis@amd.com>
Reviewed-by: Leo Liu <leo.liu@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
src/gallium/state_trackers/omx/vid_enc.c

index aa45089ae043827300d8235b505ef21fe4e8942b..df22a97a42cb8edd5d63b3482cec366d6d33cee8 100644 (file)
@@ -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);