Skip to content

Commit 9f9bf82

Browse files
committed
Fix memory leak
1 parent b83cb81 commit 9f9bf82

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

backend/sdl.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,8 +137,10 @@ twin_context_t *twin_sdl_init(int width, int height)
137137
if (!ctx)
138138
return NULL;
139139
ctx->priv = calloc(1, sizeof(twin_sdl_t));
140-
if (!ctx->priv)
140+
if (!ctx->priv) {
141+
free(ctx);
141142
return NULL;
143+
}
142144

143145
if (SDL_Init(SDL_INIT_VIDEO) < 0) {
144146
printf("error : %s\n", SDL_GetError());

0 commit comments

Comments
 (0)