Skip to content

Commit 4c8d011

Browse files
lichaofan2008deepin-bot[bot]
authored andcommitted
fix: audio_free_buffers() add a NULL check.
On the Zhaoxin processor, there is a probabilistic occurrence of null pointer/double-free issues with `audio_buffers[i].data`, so a NULL check needs to be added. 在兆芯处理器上,audio_buffers[i].data 概率性出现空指针/重复释放的情况,所以需要增加 NULL 判断。 Bug: https://pms.uniontech.com/bug-view-345713.html
1 parent eabd1bc commit 4c8d011

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

libcam/libcam_audio/audio.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,13 @@ static void audio_free_buffers()
131131

132132
for(i = 0; i < AUDBUFF_NUM; ++i)
133133
{
134+
// 在兆芯处理器上,audio_buffers[i].data 概率性出现空指针/重复释放的情况,所以这里需要增加判断
135+
if (audio_buffers[i].data == NULL) {
136+
continue;
137+
}
138+
134139
free(audio_buffers[i].data);
140+
audio_buffers[i].data = NULL;
135141
}
136142

137143
free(audio_buffers);

0 commit comments

Comments
 (0)