]> git.proxmox.com Git - mirror_spl.git/commit
Coverity 9654, 9654: Use After Free
authorBrian Behlendorf <behlendorf1@llnl.gov>
Wed, 18 Feb 2009 00:41:08 +0000 (16:41 -0800)
committerBrian Behlendorf <behlendorf1@llnl.gov>
Wed, 18 Feb 2009 00:51:19 +0000 (16:51 -0800)
commitbb01879ebe5ba5d8e2c2177d3b1ce0272c17ce07
tree16e10d8677454c210b6a86c2eef22450af640a0a
parent15dc8b072e77cf69b36e3df94782af4801d5e8cc
Coverity 9654, 9654: Use After Free

Because vmem_free() was implemented as a macro using the ','
operator to evaluate both arguments and we performed the free
before evaluating size we would deference the free'd pointer.
To resolve the problem we just invert the ordering and evaluate
size first just as if it was evaluated by the caller when being
passed to this function.  This ensure that if the caller is
doing something reckless like performing an assignment as
part of the size argument we still perform it and it simply
doesn't get removed by the macro.  Oh course nobody should
be doing this sort of thing, but just in case.
include/sys/kmem.h
libtool