client: Fix memory leaks in handle_job_opt()
authorBart Van Assche <bvanassche@acm.org>
Sat, 18 Jan 2020 05:10:41 +0000 (21:10 -0800)
committerBart Van Assche <bvanassche@acm.org>
Sat, 18 Jan 2020 06:04:39 +0000 (22:04 -0800)
This patch fixes the following Coverity complaint:

CID 169311 (#1 of 1): Resource leak (RESOURCE_LEAK)
9. leaked_storage: Variable p going out of scope leaks the storage it points to.

Signed-off-by: Bart Van Assche <bvanassche@acm.org>
client.c

index 55d89a0e54fd3696dc8685232f5e1fa02a5eb3da..93bca5dfecfa09c537137ab32a3df1c97f4535e2 100644 (file)
--- a/client.c
+++ b/client.c
@@ -1157,6 +1157,10 @@ static void handle_job_opt(struct fio_client *client, struct fio_net_cmd *cmd)
                struct flist_head *opt_list = &client->opt_lists[pdu->groupid];
 
                flist_add_tail(&p->list, opt_list);
+       } else {
+               free(p->value);
+               free(p->name);
+               free(p);
        }
 }