]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/commit
Fix memory allocation edgecases in kvm_argv(..)
authorngie <ngie@FreeBSD.org>
Sat, 30 Apr 2016 09:13:26 +0000 (09:13 +0000)
committerngie <ngie@FreeBSD.org>
Sat, 30 Apr 2016 09:13:26 +0000 (09:13 +0000)
commit874567745a9accd16d4202ffcb2482517474f2f8
tree5e2b583361331cc065489c37ffba4258719c6e75
parent470b1c2a5e88c5167cc16afc572255dfac167af1
Fix memory allocation edgecases in kvm_argv(..)

- Don't leak nbufp on realloc failure in kvm_argv
- Catch malloc errors with bufp
- Set buflen last in the "buflen == 0" case to ensure that
  bufp/nbufp is properly reallocated on the next go around

Differential Revision: https://reviews.freebsd.org/D6051
MFC after: 1 week
Reviewed by: jhb, markj
Reported by: cppcheck
Sponsored by: EMC / Isilon Storage Division
lib/libkvm/kvm_proc.c