Re: [PATCH 3/5] osm_port.c: osm_port_new fix memory leak

[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): [#def9]
> opensm-3.3.20/opensm/osm_port.c:146: alloc_fn: Storage is returned from allocation function "malloc".
> opensm-3.3.20/opensm/osm_port.c:146: var_assign: Assigning: "p_port" = storage returned from "malloc(168UL)".
> opensm-3.3.20/opensm/osm_port.c:150: noescape: Resource "p_port" is not freed or pointed-to in "memset". [Note: The source code implementation of the function has been overridden by a builtin model.]
> opensm-3.3.20/opensm/osm_port.c:151: noescape: Resource "&p_port->mcm_list" is not freed or pointed-to in "cl_qlist_init".
> opensm-3.3.20/include/complib/cl_qlist.h:435:56: noescape: "cl_qlist_init(cl_qlist_t * const)" does not free or save its parameter "p_list".
> opensm-3.3.20/opensm/osm_port.c:166: leaked_storage: Variable "p_port" going out of scope leaks the storage it points to.
> |#  164|   	p_physp = osm_node_get_physp_ptr(p_parent_node, port_num);
> |#  165|   	if (!p_physp)
> |#  166|-> 		return NULL;
> |#  167|
> |#  168|   	CL_ASSERT(port_guid == osm_physp_get_port_guid(p_physp));
> 
> 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