[Openais] [PATCH 3/8] COVERITY 17: fix exit handling in show_votes()

Steven Dake sdake at redhat.com
Fri Nov 20 17:18:57 PST 2009


This doesn't look right

on line 342 quorum_initialize is called.  Wouldn't  we want to match
with a finalize before calling return?  The cfg_finalize looks good at
line 400.

show_nodes should return a return value not void.  The value of ret in
main() should return some kind of error indicating show_nodes failed.

The rest of these routines look good.

Regards
-steve

On Sun, 2009-10-25 at 11:57 +1300, Angus Salkeld wrote:
> 399  	err_exit:
> Event uninit_use_in_call: Using uninitialized value "c_handle" in call to function "corosync_cfg_finalize" [model]
> Also see events: [var_decl]
> 400  		corosync_cfg_finalize(c_handle);
> 
> Signed-off-by: Angus Salkeld <angus.salkeld at gmail.com>
> ---
>   tools/corosync-quorumtool.c |    8 ++++----
>   1 files changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/tools/corosync-quorumtool.c b/tools/corosync-quorumtool.c
> index a1ee3ac..d43ae4a 100644
> --- a/tools/corosync-quorumtool.c
> +++ b/tools/corosync-quorumtool.c
> @@ -352,7 +352,7 @@ static void show_nodes(nodeid_format_t nodeid_format, name_format_t name_format)
>   	if (using_vq) {
>   		if ( (err=votequorum_initialize(&v_handle, &v_callbacks)) != CS_OK) {
>   			fprintf(stderr, "votequorum_initialize FAILED: %d, this is probably a configuration error\n", err);
> -			goto err_exit;
> +			return;
>   		}
>   	}
> 
> @@ -371,7 +371,7 @@ static void show_nodes(nodeid_format_t nodeid_format, name_format_t name_format)
>   	err = corosync_cfg_initialize(&c_handle, &c_callbacks);
>   	if (err != CS_OK) {
>   		fprintf(stderr, "Cannot initialise CFG service\n");
> -		goto err_exit;
> +		return;
>   	}
> 
>   	if (using_vq)
> @@ -394,9 +394,9 @@ static void show_nodes(nodeid_format_t nodeid_format, name_format_t name_format)
>   		}
>   	}
> 
> -	if (using_vq)
> +	if (using_vq) {
>   		votequorum_finalize(v_handle);
> -err_exit:
> +	}
>   	corosync_cfg_finalize(c_handle);
>   }
> 



More information about the Openais mailing list