From 8e4e7d42f1d776dc8a6e14322fdda494c973135e Mon Sep 17 00:00:00 2001 From: Romain Vimont Date: Fri, 21 Jan 2022 19:15:47 +0100 Subject: [PATCH] Fix leak on file pusher error If a file_push request fails, the allocated filename must be freed. --- app/src/scrcpy.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/app/src/scrcpy.c b/app/src/scrcpy.c index 4e7ccd6f..d628df51 100644 --- a/app/src/scrcpy.c +++ b/app/src/scrcpy.c @@ -187,7 +187,10 @@ handle_event(struct scrcpy *s, const struct scrcpy_options *options, } else { action = SC_FILE_PUSHER_ACTION_PUSH_FILE; } - sc_file_pusher_request(&s->file_pusher, action, file); + bool ok = sc_file_pusher_request(&s->file_pusher, action, file); + if (!ok) { + free(file); + } goto end; } }