mirror of
https://git.hardenedbsd.org/hardenedbsd/HardenedBSD.git
synced 2025-01-01 00:18:15 +01:00
Free allocated sbufs before returning ENOMEM.
PR: 128335 Submitted by: Mateusz Guzik <mjguzik@gmail.com> MFC after: 2 week
This commit is contained in:
parent
37dc3d28cb
commit
30215f483e
@ -935,8 +935,10 @@ cpufreq_levels_sysctl(SYSCTL_HANDLER_ARGS)
|
||||
/* Get settings from the device and generate the output string. */
|
||||
count = CF_MAX_LEVELS;
|
||||
levels = malloc(count * sizeof(*levels), M_TEMP, M_NOWAIT);
|
||||
if (levels == NULL)
|
||||
if (levels == NULL) {
|
||||
sbuf_delete(&sb);
|
||||
return (ENOMEM);
|
||||
}
|
||||
error = CPUFREQ_LEVELS(sc->dev, levels, &count);
|
||||
if (error) {
|
||||
if (error == E2BIG)
|
||||
@ -974,8 +976,10 @@ cpufreq_settings_sysctl(SYSCTL_HANDLER_ARGS)
|
||||
/* Get settings from the device and generate the output string. */
|
||||
set_count = MAX_SETTINGS;
|
||||
sets = malloc(set_count * sizeof(*sets), M_TEMP, M_NOWAIT);
|
||||
if (sets == NULL)
|
||||
if (sets == NULL) {
|
||||
sbuf_delete(&sb);
|
||||
return (ENOMEM);
|
||||
}
|
||||
error = CPUFREQ_DRV_SETTINGS(dev, sets, &set_count);
|
||||
if (error)
|
||||
goto out;
|
||||
|
Loading…
Reference in New Issue
Block a user