diff options
| -rw-r--r-- | tools/hciconfig.c | 12 | ||||
| -rw-r--r-- | tools/hcitool.c | 14 | 
2 files changed, 18 insertions, 8 deletions
| diff --git a/tools/hciconfig.c b/tools/hciconfig.c index ca44831f..745ed74f 100644 --- a/tools/hciconfig.c +++ b/tools/hciconfig.c @@ -109,8 +109,11 @@ static void print_dev_features(struct hci_dev_info *di, int format)  		di->features[3], di->features[4], di->features[5],  		di->features[6], di->features[7]); -	if (format) -		printf("%s\n", lmp_featurestostr(di->features, "\t\t", 63)); +	if (format) { +		char *tmp = lmp_featurestostr(di->features, "\t\t", 63); +		printf("%s\n", tmp); +		bt_free(tmp); +	}  }  static void cmd_rstat(int ctl, int hdev, char *opt) @@ -379,6 +382,7 @@ static void cmd_scomtu(int ctl, int hdev, char *opt)  static void cmd_features(int ctl, int hdev, char *opt)  {  	uint8_t max_page, features[8]; +	char *tmp;  	int i, dd;  	if (!(di.features[7] & LMP_EXT_FEAT)) { @@ -401,12 +405,14 @@ static void cmd_features(int ctl, int hdev, char *opt)  	}  	print_dev_hdr(&di); +	tmp = lmp_featurestostr(di.features, "\t\t", 63);  	printf("\tFeatures%s: 0x%2.2x 0x%2.2x 0x%2.2x 0x%2.2x "  				"0x%2.2x 0x%2.2x 0x%2.2x 0x%2.2x\n",  		(max_page > 0) ? " page 0" : "",  		features[0], features[1], features[2], features[3],  		features[4], features[5], features[6], features[7]); -	printf("%s\n", lmp_featurestostr(di.features, "\t\t", 63)); +	printf("%s\n", tmp); +	bt_free(tmp);  	for (i = 1; i <= max_page; i++) {  		if (hci_read_local_ext_features(dd, 1, &max_page, features, 1000) < 0) diff --git a/tools/hcitool.c b/tools/hcitool.c index ba8ba823..bc09ea07 100644 --- a/tools/hcitool.c +++ b/tools/hcitool.c @@ -379,7 +379,8 @@ static void cmd_inq(int dev_id, int argc, char **argv)  			(info+i)->dev_class[1],  			(info+i)->dev_class[0]);  	} -	free(info); + +	bt_free(info);  }  /* Device scanning */ @@ -603,13 +604,15 @@ static void cmd_scan(int dev_id, int argc, char **argv)  			}  			if (hci_read_remote_features(dd, handle, features, 20000) == 0) { +				char *tmp = lmp_featurestostr(features, "\t\t", 63);  				printf("LMP features:\t0x%2.2x 0x%2.2x 0x%2.2x 0x%2.2x"  					" 0x%2.2x 0x%2.2x 0x%2.2x 0x%2.2x\n",  					features[0], features[1],  					features[2], features[3],  					features[4], features[5],  					features[6], features[7]); -				printf("%s\n", lmp_featurestostr(features, "\t\t", 63)); +				printf("%s\n", tmp); +				bt_free(tmp);  			}  			if (cc) { @@ -622,7 +625,7 @@ static void cmd_scan(int dev_id, int argc, char **argv)  	}  	close(dd); -	free(info); +	bt_free(info);  }  /* Remote name */ @@ -786,10 +789,11 @@ static void cmd_info(int dev_id, int argc, char **argv)  	}  	if (hci_read_remote_features(dd, handle, features, 20000) == 0) { +		char *tmp = lmp_featurestostr(features, "\t\t", 63);  		printf("\tFeatures: 0x%2.2x 0x%2.2x 0x%2.2x 0x%2.2x 0x%2.2x 0x%2.2x 0x%2.2x 0x%2.2x\n%s\n",  			features[0], features[1], features[2], features[3], -			features[4], features[5], features[6], features[7], -			lmp_featurestostr(features, "\t\t", 63)); +			features[4], features[5], features[6], features[7], tmp); +		bt_free(tmp);  	}  	if (features[7] & LMP_EXT_FEAT) { | 
