bluetooth: Fix memory leaks on error or when not pairing
authorGuillem Jover <guillem@hadrons.org>
Sat, 1 Jun 2013 16:01:57 +0000 (18:01 +0200)
committerSamuel Ortiz <sameo@linux.intel.com>
Fri, 14 Jun 2013 15:46:51 +0000 (17:46 +0200)
Warned-by: cppcheck
src/bluetooth.c

index 28df08c..b446fd7 100644 (file)
@@ -756,11 +756,14 @@ int __near_bluetooth_parse_oob_record(struct carrier_data *data,
                }
                ptr = ptr + oob->bt_name_len;
        } else {
+               bt_eir_free(oob);
                return -EINVAL;
        }
 
-       if (pair == FALSE)
+       if (pair == FALSE) {
+               bt_eir_free(oob);
                return 0;
+       }
 
        /* check and get the default adapter */
        oob->def_adapter = g_strdup(bt_def_oob_data.def_adapter);