diff --git a/src/video/video.c b/src/video/video.c index 0c4672086..d3ed0794b 100644 --- a/src/video/video.c +++ b/src/video/video.c @@ -776,9 +776,11 @@ set_palette(PALETTE p) void destroy_bitmap(bitmap_t *b) { - if (b->dat != NULL) + if ((b != NULL) && (b->dat != NULL)) free(b->dat); - free(b); + + if (b != NULL) + free(b); }