OSDN Git Service

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 aa45089..df22a97 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);