diff mbox

[v2] opensm: fixed memory leak in osm_console()

Message ID 20110307153501.GQ5577@calypso.voltaire.com (mailing list archive)
State Accepted
Delegated to: Alex Netes
Headers show

Commit Message

Alex Netes March 7, 2011, 3:35 p.m. UTC
None
diff mbox

Patch

diff --git a/opensm/main.c b/opensm/main.c
index 756fe6f..b3abdbb 100644
--- a/opensm/main.c
+++ b/opensm/main.c
@@ -811,7 +811,7 @@  int main(int argc, char *argv[])
 			break;
 
 		case 'l':
-			temp = strtol(optarg, NULL, 0);
+			temp = strtoul(optarg, NULL, 0);
 			if (temp > 7) {
 				fprintf(stderr,
 					"ERROR: LMC must be 7 or less.\n");
@@ -876,8 +876,8 @@  int main(int argc, char *argv[])
 			break;
 
 		case 'p':
-			temp = strtol(optarg, NULL, 0);
-			if (0 > temp || 15 < temp) {
+			temp = strtoul(optarg, NULL, 0);
+			if (temp > 15) {
 				fprintf(stderr,
 					"ERROR: priority must be between 0 and 15\n");
 				return -1;
@@ -986,8 +986,8 @@  int main(int argc, char *argv[])
 			opt.do_mesh_analysis = TRUE;
 			break;
 		case 6:
-			temp = strtol(optarg, NULL, 0);
-			if (temp < 0 || temp >= IB_MAX_NUM_VLS) {
+			temp = strtoul(optarg, NULL, 0);
+			if (temp >= IB_MAX_NUM_VLS) {
 				fprintf(stderr,
 					"ERROR: starting lash vl must be between 0 and 15\n");
 				return -1;
@@ -996,8 +996,8 @@  int main(int argc, char *argv[])
 			printf(" LASH starting VL = %d\n", opt.lash_start_vl);
 			break;
 		case 7:
-			temp = strtol(optarg, NULL, 0);
-			if (temp < 0 || temp > 15) {
+			temp = strtoul(optarg, NULL, 0);
+			if (temp > 15) {
 				fprintf(stderr,
 					"ERROR: SM's SL must be between 0 and 15\n");
 				return -1;