Added destroy command function

This commit is contained in:
2024-03-03 17:02:24 -05:00
parent 7d9c451799
commit 1e5357c4cf

View File

@@ -72,3 +72,18 @@ static struct guestfs_inpsect_command *zmsg_to_command(zmsg_t *msg) {
}
return res;
}
static void command_destroy(struct guestfs_inpsect_command **c) {
free((*c)->name);
switch ((*c)->command) {
case GUESTFS_COMMAND_LS:
for (size_t i = 0; i < (*c)->args.ls.paths_length; i++) {
free((*c)->args.ls.paths[i]);
}
free((*c)->args.ls.paths);
break;
}
free(*c);
*c = NULL;
}