]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/commit
cppcheck: (error) Memory leak: vtoc
authorBrian Behlendorf <behlendorf1@llnl.gov>
Mon, 16 Dec 2019 18:40:29 +0000 (10:40 -0800)
committerBrian Behlendorf <behlendorf1@llnl.gov>
Thu, 19 Dec 2019 01:25:04 +0000 (17:25 -0800)
commitfe20400db5564d4478fb039e773dd43c1f546d7b
tree5824b790b76e902174ce2e6410ab335c47aed8a0
parentabfdb836079410d73ce0ee25fb4e8aec7e7c59ae
cppcheck: (error) Memory leak: vtoc

Resolve the reported memory leak by using a dedicated local vptr
variable to store the pointer reported by calloc().  Only assign the
passed **vtoc function argument on success, in all other cases vptr
is freed.

[lib/libefi/rdwr_efi.c:403]: (error) Memory leak: vtoc
[lib/libefi/rdwr_efi.c:422]: (error) Memory leak: vtoc
[lib/libefi/rdwr_efi.c:440]: (error) Memory leak: vtoc
[lib/libefi/rdwr_efi.c:454]: (error) Memory leak: vtoc
[lib/libefi/rdwr_efi.c:470]: (error) Memory leak: vtoc

Reviewed-by: Tony Hutter <hutter2@llnl.gov>
Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Closes #9732
lib/libefi/rdwr_efi.c