diff mbox series

[2/5] osmtest.c: osmtest_create_inventory_file close fh before exit

Message ID 20180828014834.3046-2-honli@redhat.com (mailing list archive)
State Not Applicable
Delegated to: Hal Rosenstock
Headers show
Series [1/5] osmt_service.c: fix resource leak in osmt_get_all_services_and_check_names | expand

Commit Message

Honggang LI Aug. 28, 2018, 1:48 a.m. UTC
From: Honggang Li <honli@redhat.com>

Signed-off-by: Honggang Li <honli@redhat.com>
---
 osmtest/osmtest.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

Comments

Hal Rosenstock Aug. 28, 2018, 9:55 a.m. UTC | #1
On 8/27/2018 9:48 PM, Honggang LI wrote:
> From: Honggang Li <honli@redhat.com>
> 
> Signed-off-by: Honggang Li <honli@redhat.com>
> ---
>  osmtest/osmtest.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/osmtest/osmtest.c b/osmtest/osmtest.c
> index 4ef78eb0..b7197bf3 100644
> --- a/osmtest/osmtest.c
> +++ b/osmtest/osmtest.c
> @@ -2736,9 +2736,8 @@ osmtest_create_inventory_file(IN osmtest_t * const p_osmt)
>  	if (status != IB_SUCCESS)
>  		goto Exit;
>  
> -	fclose(fh);
> -
>  Exit:
> +	fclose(fh);

This also closes file when not opened. Proposed patch to fix this to
follow shortly.

-- Hal

>  	OSM_LOG_EXIT(&p_osmt->log);
>  	return (status);
>  }
>
diff mbox series

Patch

diff --git a/osmtest/osmtest.c b/osmtest/osmtest.c
index 4ef78eb0..b7197bf3 100644
--- a/osmtest/osmtest.c
+++ b/osmtest/osmtest.c
@@ -2736,9 +2736,8 @@  osmtest_create_inventory_file(IN osmtest_t * const p_osmt)
 	if (status != IB_SUCCESS)
 		goto Exit;
 
-	fclose(fh);
-
 Exit:
+	fclose(fh);
 	OSM_LOG_EXIT(&p_osmt->log);
 	return (status);
 }