Skip to content

Commit 09674dc

Browse files
committed
sdl3: fix a leak when unable to lock texture
not likely to occur and even if so, it occurs just once (and init fails) CID 894256
1 parent 3aa3a22 commit 09674dc

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/video_display/sdl3.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -737,21 +737,22 @@ recreate_textures(struct state_sdl3 *s, struct video_desc desc)
737737
struct video_frame_sdl3_data *frame_data =
738738
calloc(1, sizeof *frame_data);
739739
frame_data->texture = texture;
740+
f->callbacks.dispose_udata = frame_data;
741+
f->callbacks.data_deleter = vf_sdl_texture_data_deleter;
740742
if (s->cs_data->convert != NULL) {
741743
frame_data->preconv_data = f->tiles[0].data =
742744
malloc(f->tiles[0].data_len);
743745
} else {
744746
SDL_CHECK(SDL_LockTexture(texture, NULL,
745747
(void **) &f->tiles[0].data,
746748
&s->texture_pitch),
749+
vf_free(f);
747750
return false);
748751
if (!codec_is_planar(desc.color_spec)) {
749752
f->tiles[0].data_len =
750753
desc.height * s->texture_pitch;
751754
}
752755
}
753-
f->callbacks.dispose_udata = frame_data;
754-
f->callbacks.data_deleter = vf_sdl_texture_data_deleter;
755756
simple_linked_list_append(s->free_frame_queue, f);
756757
}
757758

0 commit comments

Comments
 (0)