Change free, malloc to realloc
This commit is contained in:
parent
886b11f6bc
commit
389dd00d83
2 changed files with 2 additions and 2 deletions
|
@ -79,6 +79,7 @@ main(int argc, char **argv)
|
||||||
|
|
||||||
if (!server_init(&server, config_path)) {
|
if (!server_init(&server, config_path)) {
|
||||||
wlr_log(WLR_ERROR, "Failed to initialize server");
|
wlr_log(WLR_ERROR, "Failed to initialize server");
|
||||||
|
free(config_path);
|
||||||
exit(EXIT_FAILURE);
|
exit(EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -65,8 +65,7 @@ server_init(struct kiwmi_server *server, char *config_path)
|
||||||
|
|
||||||
if (!config_path) {
|
if (!config_path) {
|
||||||
// default config path
|
// default config path
|
||||||
free(config_path);
|
config_path = realloc(config_path, PATH_MAX);
|
||||||
config_path = malloc(PATH_MAX);
|
|
||||||
if (!config_path) {
|
if (!config_path) {
|
||||||
wlr_log(WLR_ERROR, "Falied to allocate memory");
|
wlr_log(WLR_ERROR, "Falied to allocate memory");
|
||||||
wl_display_destroy(server->wl_display);
|
wl_display_destroy(server->wl_display);
|
||||||
|
|
Loading…
Reference in a new issue