mesa/swrast: Move free calls outside the attachment loop
authorIan Romanick <ian.d.romanick@intel.com>
Fri, 12 Apr 2013 23:47:52 +0000 (16:47 -0700)
committerIan Romanick <ian.d.romanick@intel.com>
Tue, 16 Apr 2013 17:13:48 +0000 (10:13 -0700)
commita27c6e1aea1d048e0c701ca59c3c5bcf12b69d7b
tree0826d4fc722feba6ed24b46ec25bed99edba16f1
parent6758498eb79287fe5d67cd5c869e9fd387f95def
mesa/swrast: Move free calls outside the attachment loop

This was originally discovered by Klocwork analysis:

    Possible memory leak. Dynamic memory stored in 'srcBuffer0'
    allocated through function 'malloc' at line 566 can be lost at line
    746

However, I think the problem is actually much worse.  Since the memory
is freed after the first pass through the loop, the released buffer may
be used on the next iteration!

NOTE: This is a candidate for stable release branches.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
src/mesa/swrast/s_blit.c