If invalid input specified by user, memory would not be freed.

On rescan with new value, data segment memory could be attempted
to be freed.

Signed-off-by: Albert L. Chu <[email protected]>
---
 opensm/osm_subnet.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/opensm/osm_subnet.c b/opensm/osm_subnet.c
index 554a950..9845edd 100644
--- a/opensm/osm_subnet.c
+++ b/opensm/osm_subnet.c
@@ -1159,7 +1159,8 @@ int osm_subn_verify_config(IN osm_subn_opt_t * p_opts)
                log_report(" Invalid Cached Option Value:console = %s"
                           ", Using Default:%s\n",
                           p_opts->console, OSM_DEFAULT_CONSOLE);
-               p_opts->console = OSM_DEFAULT_CONSOLE;
+               free(p_opts->console);
+               p_opts->console = strdup(OSM_DEFAULT_CONSOLE);
        }
 
        if (p_opts->qos) {
-- 
1.7.1



--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to