]> git.proxmox.com Git - mirror_edk2.git/commit
StdLib/BsdSocketLib: Fix minor memory leak by freeing rrecp on error return.
authorDaryl McDaniel <edk2-lists@mc2research.org>
Tue, 16 Feb 2016 18:47:30 +0000 (10:47 -0800)
committerDaryl McDaniel <edk2-lists@mc2research.org>
Thu, 18 Feb 2016 00:11:29 +0000 (16:11 -0800)
commit7053c3b3b35275a052b2411bf73c1c4f578a0322
tree814ab346947659e8781653d659f11c0913d1d3b9
parentea3e924a0c91e2dd7fbb5e2f79899367222f27eb
StdLib/BsdSocketLib: Fix minor memory leak by freeing rrecp on error return.

The error return is triggered by one of two conditions:
  1.  rrecp is NULL (calloc failed)
  2.  strdup(dname) returns NULL

Previously, the function just returned NULL.  This patch adds a call to
free rrecp before returning NULL.  Since the free() function will properly
do nothing when called with a NULL parameter, it is not necessary to
separate the two tests into separate if clauses.

Reported-by: Colin King <colin.king@canonical.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Daryl McDaniel <edk2-lists@mc2research.org>
Reviewed-by: Jaben Carsey <jaben.carsey@intel.com>
StdLib/BsdSocketLib/res_mkupdate.c