diff options
| author | 2023-12-25 21:59:53 -0600 | |
|---|---|---|
| committer | 2023-12-25 21:59:53 -0600 | |
| commit | 5a1568cb0c3ef6ed697269add229c4d5e6829b9b (patch) | |
| tree | 80d73cb8155a4381718794a6fefe10f9e8f05567 /src/instance.c | |
| parent | [WIP] Add instances (diff) | |
add instance remove
Diffstat (limited to 'src/instance.c')
| -rw-r--r-- | src/instance.c | 6 |
1 files changed, 5 insertions, 1 deletions
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; } |
