Skip to content

Commit 46cdd56

Browse files
committed
Release the storage for title
1 parent f2b4e80 commit 46cdd56

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/syscall_sdl.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -350,12 +350,13 @@ void syscall_submit_queue(riscv_t *rv)
350350
while (count--) {
351351
submission_t submission = submission_pop(rv);
352352

353+
char *title;
353354
switch (submission.type) {
354355
case RELATIVE_MODE_SUBMISSION:
355356
SDL_SetRelativeMouseMode(submission.mouse.enabled);
356357
break;
357358
case WINDOW_TITLE_SUBMISSION:
358-
char *title = malloc(submission.title.size + 1);
359+
title = malloc(submission.title.size + 1);
359360
if (unlikely(!title))
360361
return;
361362

@@ -364,6 +365,7 @@ void syscall_submit_queue(riscv_t *rv)
364365
title[submission.title.size] = 0;
365366

366367
SDL_SetWindowTitle(window, title);
368+
free(title);
367369
break;
368370
}
369371
}

0 commit comments

Comments
 (0)