Nikola Pajkovsky <[email protected]> writes:
> ---
>  src/plugins/reporter-bugzilla.c |   35 +++++------------------------------
>  1 file changed, 5 insertions(+), 30 deletions(-)
>
> diff --git a/src/plugins/reporter-bugzilla.c b/src/plugins/reporter-bugzilla.c
> index ee0da0f..2094f06 100644
> --- a/src/plugins/reporter-bugzilla.c
> +++ b/src/plugins/reporter-bugzilla.c
> @@ -309,33 +308,9 @@ int main(int argc, char **argv)
>      VERB3 log("Bugzilla has %i reports with same duphash '%s'",
>                all_bugs_size, duphash);
>  
> -    int bug_id = -1;
> -    struct bug_info *bz = NULL;
> -    if (all_bugs_size > 0)
> -    {
> -        bug_id = rhbz_bug_id(all_bugs);
> -        xmlrpc_DECREF(all_bugs);
> -        bz = rhbz_bug_info(client, bug_id);
> -
> -        if (strcmp(bz->bi_product, rhbz.b_product) != 0)
> -        {
> -            /* found something, but its a different product */
> -            free_bug_info(bz);
> -
> -            xmlrpc_value *result = rhbz_search_duphash(client, 
> component_substitute,
> -                                                       product_substitute, 
> duphash);
> -            xmlrpc_value *all_bugs = rhbz_get_member("bugs", result);
> -            xmlrpc_DECREF(result);
> -
> -            all_bugs_size = rhbz_array_size(all_bugs);
> -            if (all_bugs_size > 0)
> -            {
> -                bug_id = rhbz_bug_id(all_bugs);
> -                bz = rhbz_bug_info(client, bug_id);
> -            }
> -            xmlrpc_DECREF(all_bugs);
> -        }
> -    }
> +    int bug_id = rhbz_bug_id(all_bugs);

The rhbz_bug_id function fails on empty array. all_bugs is an empty
array when no duplicates are found.

I'm attaching a patch to the review of your second patch that fixes this issue.

> +    xmlrpc_DECREF(all_bugs);
> +    struct bug_info *bz = rhbz_bug_info(client, bug_id);
>  
>      if (all_bugs_size == 0)
>      {

Reply via email to