Re: [PATCH 3/3] clone: Free a few paths

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

 



Hi,

Carlos MartÃn Nieto wrote:

> Free the path, repo, dir buffers
> 
> Signed-off-by: Carlos MartÃn Nieto <cmn@xxxxxxxx>
[...]
> +	free(dir);
> +	free(repo);
> +	free(path);
>  	strbuf_release(&reflog_msg);
>  	strbuf_release(&branch_top);
>  	strbuf_release(&key);

Thanks.  The commit message should probably mention that this is for
the sake of valgrind rather a true memory leak, since the memory is
freed by _exit at the appropriate time already.

The patch itself seems sane, since the performance effect should be
negligible.

But it reminds me: does "valgrind --tool=memcheck" provide a way to
annotate allocations like these?  In other words, is it be possible to
have functions xmalloc_permanent and xstrdup_permanent that

 * allocate a buffer that is never meant to be freed;
 * do not cause valgrind to complain;
 * could be reimplemented some day by taking allocations from a large
   contiguous pool, to avoid malloc overhead and to take advantage of
   the knowledge that these allocations never need to be freed

?

Curious,
Jonathan
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]