When sysctlbyname fails, free buf before returning.
Submitted by: Thomas Rix <trix@juniper.net> Reviewed by: jhb Approved by: sjg (mentor) MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D9867
This commit is contained in:
parent
bb1f43f35d
commit
038f656747
@ -46,8 +46,10 @@ kinfo_getvmobject(int *cntp)
|
||||
|
||||
buf = NULL;
|
||||
for (i = 0; i < 3; i++) {
|
||||
if (sysctlbyname("vm.objects", NULL, &len, NULL, 0) < 0)
|
||||
if (sysctlbyname("vm.objects", NULL, &len, NULL, 0) < 0) {
|
||||
free(buf);
|
||||
return (NULL);
|
||||
}
|
||||
buf = reallocf(buf, len);
|
||||
if (buf == NULL)
|
||||
return (NULL);
|
||||
|
Loading…
x
Reference in New Issue
Block a user