Browse Source

[media] media: venus: vdec: fix compile error in vdec_close

This fixes the following compile error ocured when building
with gcc7:

drivers/media/platform/qcom/venus/vdec.c:1022
vdec_close() error: dereferencing freed memory 'inst'

by moving kfree as a last call.

Signed-off-by: Stanimir Varbanov <stanimir.varbanov@linaro.org>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Stanimir Varbanov 8 years ago
parent
commit
17571ed6e2
1 changed files with 2 additions and 1 deletions
  1. 2 1
      drivers/media/platform/qcom/venus/vdec.c

+ 2 - 1
drivers/media/platform/qcom/venus/vdec.c

@@ -1017,9 +1017,10 @@ static int vdec_close(struct file *file)
 	mutex_destroy(&inst->lock);
 	v4l2_fh_del(&inst->fh);
 	v4l2_fh_exit(&inst->fh);
-	kfree(inst);
 
 	pm_runtime_put_sync(inst->core->dev_dec);
+
+	kfree(inst);
 	return 0;
 }