Re: [PATCH 5/5] osm_ucast_nue.c: fix resource leak in nue_create_context

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 8/27/2018 2:42 AM, Honggang LI wrote:
> From: Honggang Li <honli@xxxxxxxxxx>
> 
> Issue was found by Coverity.
> 
> Error: RESOURCE_LEAK (CWE-772):
> opensm-3.3.20/opensm/osm_ucast_nue.c:3159: alloc_fn: Storage is returned from allocation function "malloc".
> opensm-3.3.20/opensm/osm_ucast_nue.c:3159: var_assign: Assigning: "nue_ctx" = storage returned from "malloc(336UL)".
> opensm-3.3.20/opensm/osm_ucast_nue.c:3164: noescape: Resource "nue_ctx" is not freed or pointed-to in "create_context".
> opensm-3.3.20/opensm/osm_ucast_nue.c:3109:43: noescape: "create_context(nue_context_t *)" does not free or save its parameter "nue_ctx".
> opensm-3.3.20/opensm/osm_ucast_nue.c:3166: leaked_storage: Variable "nue_ctx" going out of scope leaks the storage it points to.
> |# 3164|   		err = create_context(nue_ctx);
> |# 3165|   		if (err)
> |# 3166|-> 			return NULL;
> |# 3167|   	} else {
> |# 3168|   		OSM_LOG(osm->sm.ucast_mgr.p_log, OSM_LOG_ERROR,
> 
> Signed-off-by: Honggang Li <honli@xxxxxxxxxx>

Thanks. Applied.

-- Hal



[Index of Archives]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Photo]     [Yosemite News]     [Yosemite Photos]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux