From 5a1568cb0c3ef6ed697269add229c4d5e6829b9b Mon Sep 17 00:00:00 2001 From: bigfoot547 Date: Mon, 25 Dec 2023 21:59:53 -0600 Subject: add instance remove --- src/instance.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'src/instance.c') diff --git a/src/instance.c b/src/instance.c index 20c0f59..148f71d 100644 --- a/src/instance.c +++ b/src/instance.c @@ -46,7 +46,7 @@ int l2_instance_load_all(void) int l2_instance_save_all(void) { json_t *js = NULL; - int instfd = l2_launcher_open_config("instance.json", O_WRONLY | O_CREAT, 0644); + int instfd = l2_launcher_open_config("instance.json", O_WRONLY | O_CREAT | O_TRUNC, 0644); if (instfd < 0) return INSTANCE_ERRNO; int retval = INSTANCE_SUCCESS; @@ -116,6 +116,10 @@ int l2_instance_del_instance(struct l2_instance *inst) l2_state.instance_head = inst->next; } + free((char *)inst->name); /* okay to cast away const because any instance in the list will be allocated with strdup */ + free((char *)inst->path); + free(inst); + return INSTANCE_SUCCESS; } -- cgit v1.2.3-70-g09d2