libmultipath: prevent memory leak in alloc_path_with_pathinfo() if pp_ptr is NULL
authorMauricio Faria de Oliveira <mauricfo@linux.vnet.ibm.com>
Wed, 14 Dec 2016 13:05:29 +0000 (11:05 -0200)
committerChristophe Varoqui <christophe.varoqui@opensvc.com>
Wed, 14 Dec 2016 18:38:08 +0000 (19:38 +0100)
commitf3f74fd1811a78cf6457c5b72aa8f4c53f39e9bd
tree50b78b6f7e33c4e5d10effae3c8a4ba7f435168d
parent45d9d4101cb49507f992b3796a76817a496f981f
libmultipath: prevent memory leak in alloc_path_with_pathinfo() if pp_ptr is NULL

In alloc_path_with_pathinfo(), if the 'pp_ptr' argument is NULL
(which is acceptable and checked in the function in two places)
the 'pp' pointer is lost as it is not referenced anywhere else;
thus the memory allocated for it is leaked.

So, call free_path() in the case 'pp_ptr' is NULL too.

Signed-off-by: Mauricio Faria de Oliveira <mauricfo@linux.vnet.ibm.com>
Reviewed-by: Hannes Reinecke <hare@suse.com>
libmultipath/discovery.c