[openib-general] [PATCH][MINOR] OpenSM/osm_ucast_updn.c: Handle failed memory allocation

Hal Rosenstock halr at voltaire.com
Mon Jan 8 21:31:00 PST 2007


OpenSM/osm_ucast_updn.c: Handle failed memory allocation

Signed-off-by: Hal Rosenstock <halr at voltaire.com>

diff --git a/osm/opensm/osm_ucast_updn.c b/osm/opensm/osm_ucast_updn.c
index 7fa119e..3d96478 100644
--- a/osm/opensm/osm_ucast_updn.c
+++ b/osm/opensm/osm_ucast_updn.c
@@ -628,6 +628,11 @@ updn_init(
         if (strlen(line) > 1)
         {
           p_tmp = malloc(sizeof(uint64_t));
+          if (!p_tmp)
+          {
+            status = IB_ERROR;
+            goto Exit;
+          }
           *p_tmp = strtoull(line, NULL, 16);
           cl_list_insert_tail(p_updn->p_root_nodes, p_tmp);
         }







More information about the general mailing list