From 4704fcacb1226d5194046df05acbbf2d57261c81 Mon Sep 17 00:00:00 2001 From: Stefan Weil Date: Fri, 2 Dec 2016 22:17:41 +0100 Subject: [PATCH] cube: Fix use after free regression Coverity report: CID 1366758: Memory - corruptions (USE_AFTER_FREE) Calling "operator delete[]" frees pointer "label32" which has already been freed. Commit f60ff4d57560b2daf03951015dd188446ce50024 fixed several memory leaks but also added this wrong delete operation. label32 is assigned to char_samp->label32_, so it is freed when deleting char_samp. Signed-off-by: Stefan Weil --- cube/char_samp.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/cube/char_samp.cpp b/cube/char_samp.cpp index 4b9887e4e4..f55735be0e 100644 --- a/cube/char_samp.cpp +++ b/cube/char_samp.cpp @@ -166,7 +166,6 @@ CharSamp *CharSamp::FromCharDumpFile(CachedFile *fp) { // load the Bmp8 part if (char_samp->LoadFromCharDumpFile(fp) == false) { delete char_samp; - delete [] label32; return NULL; } return char_samp;