From 3673ae37caa158f171ee4f950a8eb9a1343abe3f Mon Sep 17 00:00:00 2001 From: Charlotte Meyer Date: Wed, 11 Dec 2019 13:46:09 +0000 Subject: [PATCH] Change free, malloc to realloc --- kiwmi/main.c | 1 + kiwmi/server.c | 3 +-- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/kiwmi/main.c b/kiwmi/main.c index 64522d0..d15824b 100644 --- a/kiwmi/main.c +++ b/kiwmi/main.c @@ -79,6 +79,7 @@ main(int argc, char **argv) if (!server_init(&server, config_path)) { wlr_log(WLR_ERROR, "Failed to initialize server"); + free(config_path); exit(EXIT_FAILURE); } diff --git a/kiwmi/server.c b/kiwmi/server.c index 0b8f9ac..5ac41ea 100644 --- a/kiwmi/server.c +++ b/kiwmi/server.c @@ -65,8 +65,7 @@ server_init(struct kiwmi_server *server, char *config_path) if (!config_path) { // default config path - free(config_path); - config_path = malloc(PATH_MAX); + config_path = realloc(config_path, PATH_MAX); if (!config_path) { wlr_log(WLR_ERROR, "Falied to allocate memory"); wl_display_destroy(server->wl_display);