iFix mem leak - dedup - deduplicating backup program Err bitreich.org 70 hgit clone git://bitreich.org/dedup/ git://enlrupgkhuxnvlhsf6lc3fziv5h2hhfrinws65d7roiv6bfj7d652fid.onion/dedup/ URL:git://bitreich.org/dedup/ git://enlrupgkhuxnvlhsf6lc3fziv5h2hhfrinws65d7roiv6bfj7d652fid.onion/dedup/ bitreich.org 70 1Log /scm/dedup/log.gph bitreich.org 70 1Files /scm/dedup/files.gph bitreich.org 70 1Refs /scm/dedup/refs.gph bitreich.org 70 1Tags /scm/dedup/tag bitreich.org 70 1README /scm/dedup/file/README.gph bitreich.org 70 1LICENSE /scm/dedup/file/LICENSE.gph bitreich.org 70 i--- Err bitreich.org 70 1commit 13ea526261fd0d7821dbf271bd9ccd509ae4e6fd /scm/dedup/commit/13ea526261fd0d7821dbf271bd9ccd509ae4e6fd.gph bitreich.org 70 1parent 2646d0e4e3cbc7b6fe481958d112d7ba1d654911 /scm/dedup/commit/2646d0e4e3cbc7b6fe481958d112d7ba1d654911.gph bitreich.org 70 hAuthor: sin URL:mailto:sin@2f30.org bitreich.org 70 iDate: Tue, 5 Mar 2019 13:52:27 +0000 Err bitreich.org 70 i Err bitreich.org 70 iFix mem leak Err bitreich.org 70 i Err bitreich.org 70 iIf the node already exists in the rb-tree a pointer to it is returned. Err bitreich.org 70 iIn that case we can free the temporary node that was allocated because Err bitreich.org 70 iit will not be used. Err bitreich.org 70 i Err bitreich.org 70 iDiffstat: Err bitreich.org 70 i M cache.c | 3 ++- Err bitreich.org 70 i Err bitreich.org 70 i1 file changed, 2 insertions(+), 1 deletion(-) Err bitreich.org 70 i--- Err bitreich.org 70 1diff --git a/cache.c b/cache.c /scm/dedup/file/cache.c.gph bitreich.org 70 i@@ -83,7 +83,8 @@ add_cache_entry(struct cache *cache, struct cache_entry *ent) Err bitreich.org 70 i struct cache_node *node; Err bitreich.org 70 i Err bitreich.org 70 i node = alloc_cache_node(ent); Err bitreich.org 70 i- RB_INSERT(cache_head, &cache->nodes, node); Err bitreich.org 70 i+ if (RB_INSERT(cache_head, &cache->nodes, node) != NULL) Err bitreich.org 70 i+ free_cache_node(node); Err bitreich.org 70 i } Err bitreich.org 70 i Err bitreich.org 70 i int Err bitreich.org 70 .