Source-Changes-D archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: CVS commit: src/lib/libc/stdlib



On Mon, 01 Nov 2010, enami tsugutomo wrote:
> Modified Files:
>       src/lib/libc/stdlib: getenv.c
> 
> Log Message:
> Double the array only when really necessary.  Otherwise memory will be
> exhausted if user modifies the variable envrion itself repeatedly..

Now the code disagrees with the comment above it.  Please fix the comment.

>       /* Make sure we at least double the size of the arrays. */
> -     new_len = (environ_malloced_len >= 16) ?
> -         (environ_malloced_len << 1) : 16;
> +     new_len = environ_malloced_len >= 16 ? environ_malloced_len : 16;

--apb (Alan Barrett)


Home | Main Index | Thread Index | Old Index