[PATCH] libx11:lcDefConv.c:fix use before check

Mark Kettenis mark.kettenis at xs4all.nl
Wed Jun 4 04:40:51 PDT 2014


> Date: Wed, 04 Jun 2014 13:28:35 +0200
> From: walter harms <wharms at bfs.de>
> 
> Am 04.06.2014 12:23, schrieb Mark Kettenis:
> >> Date: Wed, 04 Jun 2014 12:07:25 +0200
> >> From: walter harms <wharms at bfs.de>
> >>
> >> Do not use variables before checked for NULL.
> >>
> >>
> >> Signed-off-by: wharms <wharms at bfs.de>
> >>
> >> ---
> >>  modules/lc/def/lcDefConv.c | 35 +++++++++++++++++++++++++----------
> >>  1 file changed, 25 insertions(+), 10 deletions(-)
> >>
> >> diff --git a/modules/lc/def/lcDefConv.c b/modules/lc/def/lcDefConv.c
> >> index 3cd5c22..2cae504 100644
> >> --- a/modules/lc/def/lcDefConv.c
> >> +++ b/modules/lc/def/lcDefConv.c
> >> @@ -181,14 +182,16 @@ def_wcstombs(
> >>      XPointer *args,
> >>      int num_args)
> >>  {
> >> -    const wchar_t *src = (const wchar_t *) * from;
> >> +    const wchar_t *src;
> >>      char  *dst = (char *) *to;
> >>      State state = (State) conv->state;
> >>      char ch[MB_LEN_MAX];
> >>      int unconv = 0;
> >>
> >>      if (from == NULL || *from == NULL)
> >> -	return 0;
> >> +      return 0;
> >> +
> >> +    src = (const wchar_t *) * from;
> > 
> > While there, you should probably remove the space after the '*'.
> > There are a couple of more occurances further down.
> 
> you mean:
> src = (const wchar_t *) *from;  ?

yup


More information about the xorg-devel mailing list