>From c7fd1c7668acc5f5c1819f23b35a0baad0c09045 Mon Sep 17 00:00:00 2001
From: Sasha Khapyorsky <[EMAIL PROTECTED]>
Date: Thu, 13 Nov 2008 01:20:07 +0200
Subject: [PATCH] opensm/osm_subnet.c: use strdup() function
Instead of malloc() and strcpy() use strdup() function.
Signed-off-by: Sasha Khapyorsky <[EMAIL PROTECTED]>
---
opensm/opensm/osm_subnet.c | 9 +++------
1 files changed, 3 insertions(+), 6 deletions(-)
diff --git a/opensm/opensm/osm_subnet.c b/opensm/opensm/osm_subnet.c
index 666c93c..cd8c8e5 100644
--- a/opensm/opensm/osm_subnet.c
+++ b/opensm/opensm/osm_subnet.c
@@ -611,8 +611,7 @@ opts_unpack_charp(IN char *p_req_key,
Ignore the possible memory leak here;
the pointer may be to a static default.
*/
- *p_val = (char *)malloc(strlen(p_val_str) + 1);
- strcpy(*p_val, p_val_str);
+ *p_val = strdup(p_val_str);
}
}
}
@@ -874,8 +873,7 @@ static void subn_verify_vlarb(IN char *vlarb, IN char *key)
char *str, *tok, *end, *ptr;
int count = 0;
- str = (char *)malloc(strlen(vlarb) + 1);
- strcpy(str, vlarb);
+ str = strdup(vlarb);
tok = strtok_r(str, ",\n", &ptr);
while (tok) {
@@ -936,8 +934,7 @@ static void subn_verify_sl2vl(IN char *sl2vl, IN char *key)
char *str, *tok, *end, *ptr;
int count = 0;
- str = (char *)malloc(strlen(sl2vl) + 1);
- strcpy(str, sl2vl);
+ str = strdup(sl2vl);
tok = strtok_r(str, ",\n", &ptr);
while (tok) {
--
1.6.0.3.517.g759a
_______________________________________________
general mailing list
[email protected]
http://lists.openfabrics.org/cgi-bin/mailman/listinfo/general
To unsubscribe, please visit http://openib.org/mailman/listinfo/openib-general