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
3bf92db198
commit
2774665e4b
@ -196,8 +196,10 @@ read_freqs(int *numfreqs, int **freqs, int **power, int minfreq, int maxfreq)
|
|||||||
return (-1);
|
return (-1);
|
||||||
if ((freqstr = malloc(len)) == NULL)
|
if ((freqstr = malloc(len)) == NULL)
|
||||||
return (-1);
|
return (-1);
|
||||||
if (sysctl(levels_mib, 4, freqstr, &len, NULL, 0))
|
if (sysctl(levels_mib, 4, freqstr, &len, NULL, 0)) {
|
||||||
|
free(freqstr);
|
||||||
return (-1);
|
return (-1);
|
||||||
|
}
|
||||||
|
|
||||||
*numfreqs = 1;
|
*numfreqs = 1;
|
||||||
for (p = freqstr; *p != '\0'; p++)
|
for (p = freqstr; *p != '\0'; p++)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user