[patch 4/4] wordexp: avoid strdup and cleanup memory handling
Corinna Vinschen
vinschen@redhat.com
Wed Oct 10 16:27:00 GMT 2012
On Oct 9 13:54, Peter Rosin wrote:
> On 2012-10-09 13:00, Peter Rosin wrote:
> > On 2012-10-09 11:58, Corinna Vinschen wrote:
> >> Hi Peter,
> >>
> >> On Oct 9 10:06, Peter Rosin wrote:
> >>> [...]
> >>> @@ -142,11 +148,14 @@ wordexp(const char *words, wordexp_t *pw
> >>>
> >>> num_words = atoi(tmp);
> >>>
> >>> - wordv = (char **)realloc(pwordexp->we_wordv,
> >>> - (pwordexp->we_wordc + num_words + offs + 1) * sizeof(char *));
> >>> + if (pwordexp->we_wordv)
> >>> + wordv = we_wordv_to_ext_wordv(pwordexp->we_wordv);
> >> ^^^^^^^^^^^^^^^^^^^^^
> >> This is supposed to be uppercase, right?
> >
> > Right. I'm not sure how that ended up in there, but I have tested
> > this standalone without rebuilding newlib, so I guess I must have
> > screwed up the code juggling somewhere. I had it lower case first,
> > as an inline, but made it a macro instead. The reason for not going
> > with the inline function escapes me at the moment.
> >
> > But that mixup of course make me unsure if the rest is also as I
> > intended. I'll get back once I have retested it...
>
> Ok, I have retested and rechecked, and that case cock-up is the
> only badness I can find. Please go ahead.
Done. Thanks for the patches!
Corinna
--
Corinna Vinschen
Cygwin Project Co-Leader
Red Hat
More information about the Newlib
mailing list