Check a return value of malloc() run-time instead of debug macro.

Signed-off-by: Sasha Khapyorsky <sas...@voltaire.com>
---
 opensm/opensm/osm_db_files.c |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)

diff --git a/opensm/opensm/osm_db_files.c b/opensm/opensm/osm_db_files.c
index 07a9ce0..18ac830 100644
--- a/opensm/opensm/osm_db_files.c
+++ b/opensm/opensm/osm_db_files.c
@@ -157,7 +157,10 @@ int osm_db_init(IN osm_db_t * p_db, IN osm_log_t * p_log)
        OSM_LOG_ENTER(p_log);
 
        p_db_imp = malloc(sizeof(osm_db_imp_t));
-       CL_ASSERT(p_db_imp != NULL);
+       if (!p_db_imp) {
+               OSM_LOG(p_log, OSM_LOG_ERROR, "ERR 6100: No memory.\n");
+               return -1;
+       }
 
        p_db_imp->db_dir_name = getenv("OSM_CACHE_DIR");
        if (!p_db_imp->db_dir_name || !(*p_db_imp->db_dir_name))
-- 
1.7.0.4

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

Reply via email to