Fix Memory leak 02/179402/1
authorNagaraj D R <nagaraj.dr@samsung.com>
Thu, 17 May 2018 14:28:03 +0000 (19:58 +0530)
committerNagaraj D R <nagaraj.dr@samsung.com>
Thu, 17 May 2018 14:30:06 +0000 (20:00 +0530)
Memory associated with 'adv_data' will be leaked in case of
'generate_scan_rsp' failure

Change-Id: I57fdaa060ecfbf59f03ca16e074ddce7a8e14c9d

src/advertising.c [changed mode: 0755->0644]

old mode 100755 (executable)
new mode 100644 (file)
index 94a8c40..e6bb180
@@ -636,6 +636,7 @@ static int refresh_adv(struct btd_adv_client *client, mgmt_request_func_t func)
        scan_rsp = generate_scan_rsp(client, &flags, &scan_rsp_len);
        if (!scan_rsp && scan_rsp_len) {
                error("Scan data couldn't be generated.");
+               free(adv_data);
                return -EINVAL;
        }