Usage of potentially NULL pointers
Signed-off-by: Anuj Jain <anuj01.jain@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
cp_len = sizeof(*cp) + argc * sizeof(struct mgmt_adv_pattern);
cp = malloc0(cp_len);
+ if (!cp) {
+ error("Failed to alloc patterns.");
+ success = false;
+ goto done;
+ }
+
cp->pattern_count = argc;
for (i = 0; i < argc; i++) {
cp_len = sizeof(*cp) + argc * sizeof(struct mgmt_adv_pattern);
cp = malloc0(cp_len);
+ if (!cp) {
+ error("Failed to alloc patterns.");
+ success = false;
+ goto done;
+ }
+
cp->pattern_count = argc;
cp->rssi.high_threshold = rssi_high;
cp->rssi.low_threshold = rssi_low;