mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-07 20:33:58 -04:00
dsp: bugfix for memory leak in error handling path
Add extra goto label in order to free memory in case program failed to acquire memory through callback_node. With the original code, there might be a situation where the memory acquired by client_info_node will not be freed, thus causing possible memory leak. Change-Id: If5c8a4bdfbed4ada57a7563e9e212dc9aa7caab0 Signed-off-by: Jinjuan Qiu <jinjqiu@codeaurora.org>
This commit is contained in:
parent
deec79da50
commit
ff8d8d4270
1 changed files with 6 additions and 3 deletions
9
dsp/audio_calibration.c
Executable file → Normal file
9
dsp/audio_calibration.c
Executable file → Normal file
|
|
@ -148,7 +148,7 @@ int audio_cal_register(int num_cal_types,
|
|||
GFP_KERNEL);
|
||||
if (callback_node == NULL) {
|
||||
ret = -ENOMEM;
|
||||
goto err;
|
||||
goto err_callback_node;
|
||||
}
|
||||
|
||||
memcpy(callback_node, ®_data[i].callbacks,
|
||||
|
|
@ -160,10 +160,13 @@ int audio_cal_register(int num_cal_types,
|
|||
&audio_cal.client_info[reg_data[i].cal_type]);
|
||||
mutex_unlock(&audio_cal.cal_mutex[reg_data[i].cal_type]);
|
||||
}
|
||||
done:
|
||||
return ret;
|
||||
goto done;
|
||||
|
||||
err_callback_node:
|
||||
kfree(client_info_node);
|
||||
err:
|
||||
audio_cal_deregister(num_cal_types, reg_data);
|
||||
done:
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue