This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [patch] Fix using_directive memory leak pr 11236


>>>>> "Sami" == Sami Wagiaalla <swagiaal@redhat.com> writes:

Sami>     2010-03-08  Sami Wagiaalla  <swagiaal@redhat.com>
Sami>     	* cp-namespace.c (cp_add_using): Deleted.

Mention the PR in the ChangeLog entry.

Sami>        if (strcmp (current->import_src, src) == 0
Sami> -          && strcmp (current->import_dest, dest) == 0)
Sami> +          && strcmp (current->import_dest, dest) == 0
Sami> +          && ((!alias && !current->alias)
Sami> +              || strcmp (current->alias, alias) == 0))

I think this test is still wrong.

First, I think this will crash if alias==NULL but current->alias!=NULL,
or vice versa, because the code can still reach the strcmp.

Second, it doesn't really test the right thing.  I think you want
something like:

  && ((alias == NULL && current->alias == NULL)
      || (alias != NULL && current->alias != NULL
          && strcmp (alias, current->alias) == 0))

Tom


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]