public inbox for linux-rdma@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] opensm/osm_db_files.c: fix small memory leak
@ 2010-09-07 15:05 Yevgeny Kliteynik
       [not found] ` <4C8654C0.7020208-VPRAkNaXOzVS1MOuV/RT9w@public.gmane.org>
  0 siblings, 1 reply; 3+ messages in thread
From: Yevgeny Kliteynik @ 2010-09-07 15:05 UTC (permalink / raw)
  To: Sasha Khapyorsky, Linux RDMA


Signed-off-by: Yevgeny Kliteynik <kliteyn-LDSdmyG8hGV8YrgS2mwiifqBs+8SCbDb@public.gmane.org>
---
 opensm/opensm/osm_db_files.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/opensm/opensm/osm_db_files.c b/opensm/opensm/osm_db_files.c
index c475004..603bcf2 100644
--- a/opensm/opensm/osm_db_files.c
+++ b/opensm/opensm/osm_db_files.c
@@ -175,6 +175,7 @@ int osm_db_init(IN osm_db_t * p_db, IN osm_log_t * p_log)
 			OSM_LOG(p_log, OSM_LOG_ERROR, "ERR 6101: "
 				"Failed to create the db directory:%s\n",
 				p_db_imp->db_dir_name);
+			free(p_db_imp);
 			OSM_LOG_EXIT(p_log);
 			return 1;
 		}
-- 
1.6.2.4

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

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] opensm/osm_db_files.c: fix small memory leak
       [not found] ` <4C8654C0.7020208-VPRAkNaXOzVS1MOuV/RT9w@public.gmane.org>
@ 2010-09-09 14:42   ` Sasha Khapyorsky
  2010-09-09 14:47   ` [PATCH] opensm/osm_db_files.c: malloc() return value run-time check Sasha Khapyorsky
  1 sibling, 0 replies; 3+ messages in thread
From: Sasha Khapyorsky @ 2010-09-09 14:42 UTC (permalink / raw)
  To: kliteyn-LDSdmyG8hGV8YrgS2mwiifqBs+8SCbDb; +Cc: Linux RDMA

On 18:05 Tue 07 Sep     , Yevgeny Kliteynik wrote:
> 
> Signed-off-by: Yevgeny Kliteynik <kliteyn-LDSdmyG8hGV8YrgS2mwiifqBs+8SCbDb@public.gmane.org>

Applied. Thanks.

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

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [PATCH] opensm/osm_db_files.c: malloc() return value run-time check
       [not found] ` <4C8654C0.7020208-VPRAkNaXOzVS1MOuV/RT9w@public.gmane.org>
  2010-09-09 14:42   ` Sasha Khapyorsky
@ 2010-09-09 14:47   ` Sasha Khapyorsky
  1 sibling, 0 replies; 3+ messages in thread
From: Sasha Khapyorsky @ 2010-09-09 14:47 UTC (permalink / raw)
  To: kliteyn-LDSdmyG8hGV8YrgS2mwiifqBs+8SCbDb; +Cc: Linux RDMA


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

Signed-off-by: Sasha Khapyorsky <sashak-smomgflXvOZWk0Htik3J/w@public.gmane.org>
---
 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 majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2010-09-09 14:47 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-09-07 15:05 [PATCH] opensm/osm_db_files.c: fix small memory leak Yevgeny Kliteynik
     [not found] ` <4C8654C0.7020208-VPRAkNaXOzVS1MOuV/RT9w@public.gmane.org>
2010-09-09 14:42   ` Sasha Khapyorsky
2010-09-09 14:47   ` [PATCH] opensm/osm_db_files.c: malloc() return value run-time check Sasha Khapyorsky

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox