swaylock: fix build

This commit is contained in:
Markus Volk 2021-08-20 13:51:05 +02:00
parent 2c90e0a6de
commit 69291882c6
2 changed files with 35 additions and 0 deletions

View File

@ -0,0 +1,31 @@
From 3e861934074148dc803e70508ad99dfbd0d14765 Mon Sep 17 00:00:00 2001
From: Markus Volk <f_l_k@t-online.de>
Date: Fri, 20 Aug 2021 13:42:57 +0200
Subject: [PATCH] load_config: fix mismatched allocation function
| In function 'load_config',
| inlined from 'main' at ../git/main.c:1138:23:
| ../git/main.c:1060:25: error: 'free' called on pointer returned from a mismatched allocation function [-Werror=mismatched-dealloc]
| 1060 | free(config);
Signed-off-by: Markus Volk <f_l_k@t-online.de>
---
main.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/main.c b/main.c
index c65d68a..7921770 100644
--- a/main.c
+++ b/main.c
@@ -1057,7 +1057,7 @@ static int load_config(char *path, struct swaylock_state *state,
char *flag = malloc(nread + 3);
if (flag == NULL) {
free(line);
- free(config);
+ fclose(config);
swaylock_log(LOG_ERROR, "Failed to allocate memory");
return 0;
}
--
2.25.1

View File

@ -18,6 +18,7 @@ DEPENDS = " \
SRC_URI = " \ SRC_URI = " \
git://github.com/swaywm/swaylock.git;protocol=https \ git://github.com/swaywm/swaylock.git;protocol=https \
file://0001-load_config-fix-mismatched-allocation-function.patch \
" "
S = "${WORKDIR}/git" S = "${WORKDIR}/git"
@ -33,6 +34,9 @@ PACKAGECONFIG ?= " \
pam \ pam \
" "
# Reproducibility issue. Fix me!
CFLAGS:append = " -Wno-error=date-time"
inherit meson pkgconfig features_check inherit meson pkgconfig features_check
EXTRA_OEMESON += "--buildtype release" EXTRA_OEMESON += "--buildtype release"