powerd(8): Fix a memory leak when we fail to read frequency levels.
PR: 242967 Submitted by: Hans Christian Woithe <chwoithe@yahoo.com> MFC after: 3 days
This commit is contained in:
parent
758b2c02bb
commit
2a73387f1c
@ -196,8 +196,10 @@ read_freqs(int *numfreqs, int **freqs, int **power, int minfreq, int maxfreq)
|
||||
return (-1);
|
||||
if ((freqstr = malloc(len)) == NULL)
|
||||
return (-1);
|
||||
if (sysctl(levels_mib, 4, freqstr, &len, NULL, 0))
|
||||
if (sysctl(levels_mib, 4, freqstr, &len, NULL, 0)) {
|
||||
free(freqstr);
|
||||
return (-1);
|
||||
}
|
||||
|
||||
*numfreqs = 1;
|
||||
for (p = freqstr; *p != '\0'; p++)
|
||||
|
Loading…
Reference in New Issue
Block a user