# Sdl12-compat: Quit12Video: clean-up static data by calling EndVidModeCreate()

**URL:** <https://discourse.libsdl.org/t/sdl12-compat-quit12video-clean-up-static-data-by-calling-endvidmodecreate/28878>\
**Category:** SDL Commits\
**Created:** [February 20, 2021, 9:14pm UTC](https://discourse.libsdl.org/t/sdl12-compat-quit12video-clean-up-static-data-by-calling-endvidmodecreate/28878 "2021-02-20T21:14:02Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![SDLPushPostBot](https://discourse.libsdl.org/user_avatar/discourse.libsdl.org/sdlpushpostbot/32/4370_2.png) [@SDLPushPostBot](https://discourse.libsdl.org/u/SDLPushPostBot)\
**Post date:** [February 20, 2021, 9:14pm UTC](https://discourse.libsdl.org/t/sdl12-compat-quit12video-clean-up-static-data-by-calling-endvidmodecreate/28878/1 "2021-02-20T21:14:02Z")

</div>

> <https://github.com/libsdl-org/sdl12-compat/commit/0907a833f55becedc09e948c6065f795b943d122>

```diff
From 0907a833f55becedc09e948c6065f795b943d122 Mon Sep 17 00:00:00 2001
From: Ozkan Sezer <[EMAIL REDACTED]>
Date: Sun, 21 Feb 2021 00:12:50 +0300
Subject: [PATCH] Quit12Video: clean-up static data by calling
 EndVidModeCreate().

fixes segmentation fault upon video quit and re-init reported at
https://github.com/libsdl-org/sdl12-compat/issues/24
---
 src/SDL12_compat.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/src/SDL12_compat.c b/src/SDL12_compat.c
index 9e3588d..dae2c57 100644
--- a/src/SDL12_compat.c
+++ b/src/SDL12_compat.c
@@ -1365,6 +1365,7 @@ SDL_WasInit(Uint32 sdl12flags)
     return InitFlags20to12(SDL20_WasInit(sdl20flags)) | extraflags;
 }
 
+static SDL12_Surface *EndVidModeCreate(void);
 static void
 Quit12Video(void)
 {
@@ -1373,6 +1374,8 @@ Quit12Video(void)
     SDL20_FreeSurface(VideoIcon20);
     VideoIcon20 = NULL;
 
+ EndVidModeCreate(); /* clean-up static data. */
+
     for (i = 0; i < VideoModesCount; i++) {
         SDL20_free(VideoModes[i].modeslist12);
         SDL20_free(VideoModes[i].modes12);

```
