mirror of
https://github.com/baldurk/renderdoc.git
synced 2026-10-08 21:31:36 +00:00
Don't crash on NULL pointers being dealloc'd
* The error handling code will be OK if a NULL parameter was passed in but during cleanup it will go through tempdealloc, so we need to check that the pointer is actually valid.
This commit is contained in:
1 parent
27ae30aaa3
commit
21836c240d
1 file changed
+5
-1
@@ -978,7 +978,11 @@ struct pointer_unwrap<T, true>
|
||||
|
||||
static void tempset(U *&ptr, U *tempobj) { ptr = tempobj; }
|
||||
static void tempalloc(U *&ptr, unsigned char *tempmem) { ptr = new(tempmem) U; }
|
||||
static void tempdealloc(U *ptr) { ptr->~U(); }
|
||||
static void tempdealloc(U *ptr)
|
||||
{
|
||||
if(ptr)
|
||||
ptr->~U();
|
||||
}
|
||||
static U &indirect(U *ptr) { return *ptr; }
|
||||
};
|
||||
};
|
||||
|
||||
Reference in new issue
Block a user