On Friday 04 March 2011 11:58, Alexey Soloviev wrote:
> Corrected subject or previously sent message. Sorry for the mistake.
> 
> There are quite many places where allocated memory is not freed.
> Here is a fix for trivial case in tr.
> 
> Signed-off-by: Alexey Soloviev<[email protected]>
> ---
>   coreutils/tr.c |    5 +++++
>   1 files changed, 5 insertions(+), 0 deletions(-)
> 
> diff --git a/coreutils/tr.c b/coreutils/tr.c
> index 21d77ef..8dd4a33 100644
> --- a/coreutils/tr.c
> +++ b/coreutils/tr.c
> @@ -323,6 +323,11 @@ int tr_main(int argc UNUSED_PARAM, char **argv)
>           }
>           str2[out_index++] = last = coded;
>       }
> +    if (ENABLE_FEATURE_CLEAN_UP) {
> +        free(vector);
> +        free(str2);
> +        free(str1);
> +    }
> 
>       return EXIT_SUCCESS;
>   }


# patch -p1 </tmp/\[PATCH\]\ free\ allocated\ memory\ in\ tr\ if\ CLEANUP\ 
enabled --dry-run
patching file coreutils/tr.c
Hunk #1 FAILED at 323.
1 out of 1 hunk FAILED -- saving rejects to file coreutils/tr.c.rej

-- 
vda
_______________________________________________
busybox mailing list
[email protected]
http://lists.busybox.net/mailman/listinfo/busybox

Reply via email to