This is the mail archive of the newlib@sourceware.org mailing list for the newlib 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 4/4] wordexp: avoid strdup and cleanup memory handling


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...

Cheers,
Peter


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