rsaenh: Avoid double 'va_end(args)' in case of a premature loop termination.

Dmitry Timoshkov dmitry at baikal.ru
Wed Jun 21 22:50:56 CDT 2017


Sebastian Lackner <sebastian at fds-team.de> wrote:

> >>> diff --git a/dlls/rsaenh/mpi.c b/dlls/rsaenh/mpi.c
> >>> index 03e31023e6..dcf6ddf112 100644
> >>> --- a/dlls/rsaenh/mpi.c
> >>> +++ b/dlls/rsaenh/mpi.c
> >>> @@ -2365,10 +2365,7 @@ int mp_init_multi(mp_int *mp, ...)
> >>>                 succeeded in init-ing, then return error.
> >>>              */
> >>>              va_list clean_args;
> >>> -            
> >>> -            /* end the current list */
> >>> -            va_end(args);
> >>> -            
> >>> +
> >>>              /* now start cleaning up */            
> >>>              cur_arg = mp;
> >>>              va_start(clean_args, mp);
> >>> @@ -2381,6 +2378,7 @@ int mp_init_multi(mp_int *mp, ...)
> >>>              break;
> >>>          }
> >>>          n++;
> >>> +        va_end(args);
> >>
> >> Doesn't this change make it even worse? Whats the purpose of calling va_end()
> >> when the enumeration isn't finished yet?
> > 
> > Do you have a suggestion for a better fix?
> > 
> 
> If I don't miss anything, just removing the duplicate va_end() call in
> line 2370 should be sufficient. The "break;" will ensure it still gets
> called before the function returns.

Thanks, somehow an obvious solution eluded my mind.

-- 
Dmitry.



More information about the wine-devel mailing list