On Mon, Oct 12, 2015 at 10:59:35AM +0200, Christian Hesse wrote:
> From: Christian Hesse <m...@eworm.de>
> 
> string_list_insert() expects (const char*), so no need to duplicate and
> free the string.
> 
> Signed-off-by: Christian Hesse <m...@eworm.de>
> ---
>  ui-stats.c | 9 ++-------
>  1 file changed, 2 insertions(+), 7 deletions(-)

This has the same problem as the previous patch.

> diff --git a/ui-stats.c b/ui-stats.c
> index 02335e7..26473de 100644
> --- a/ui-stats.c
> +++ b/ui-stats.c
> @@ -171,24 +171,19 @@ static void add_commit(struct string_list *authors, 
> struct commit *commit,
>       struct string_list_item *author, *item;
>       struct authorstat *authorstat;
>       struct string_list *items;
> -     char *tmp;
>       struct tm *date;
>       time_t t;
>  
>       info = cgit_parse_commit(commit);
> -     tmp = xstrdup(info->author);
> -     author = string_list_insert(authors, tmp);
> +     author = string_list_insert(authors, info->author);
>       if (!author->util)
>               author->util = xcalloc(1, sizeof(struct authorstat));
> -     free(tmp);
>       authorstat = author->util;
>       items = &authorstat->list;
>       t = info->committer_date;
>       date = gmtime(&t);
>       period->trunc(date);
> -     tmp = xstrdup(period->pretty(date));
> -     item = string_list_insert(items, tmp);
> -     free(tmp);
> +     item = string_list_insert(items, period->pretty(date));
>       item->util++;
>       authorstat->total++;
>       cgit_free_commitinfo(info);
> -- 
> 2.6.1
_______________________________________________
CGit mailing list
CGit@lists.zx2c4.com
http://lists.zx2c4.com/mailman/listinfo/cgit

Reply via email to