20dfab33f5
The deallocated memory contains resources that need to be freed before it can be deallocated. The original code was correct. This also fixes a double free Signed-off-by: Michael Niedermayer <michaelni@gmx.at>