mirror of
https://github.com/team-infusion-developers/android_kernel_samsung_msm8976.git
synced 2024-10-31 18:09:19 +00:00
ASoC: qdsp6v2: prevent null pointer dereference for _vol_cmds
In case of memory allocation failure, _vol_cmd_cnt is not reset. In _volume_cmds_free, null pointer dereference would happen for _vol_cmds[i]. To prevent it, reset _vol_cmd_cnt when memory allocation fails. CRs-Fixed: 1089598 Change-Id: Icb998549cdb999c6db2fd52aef505f200e630da5 Signed-off-by: Xiaojun Sang <xsang@codeaurora.org>
This commit is contained in:
parent
29f346365d
commit
5e9c8dba56
1 changed files with 2 additions and 1 deletions
|
@ -236,7 +236,8 @@ static s32 _volume_cmds_alloc1(s32 size)
|
|||
if (_vol_cmds) {
|
||||
_vol_cmds_d = kzalloc(_vol_cmd_cnt * sizeof(struct vol_cmds_d),
|
||||
GFP_KERNEL);
|
||||
}
|
||||
} else
|
||||
_vol_cmd_cnt = 0;
|
||||
if (_vol_cmds_d)
|
||||
return 0;
|
||||
_volume_cmds_free();
|
||||
|
|
Loading…
Reference in a new issue