[libgit2-glib] tree: dup the entry and free it ourselves.



commit 135c5761075f875287960f9f7f461645e7b0e6f1
Author: Ignacio Casal Quinteiro <icq gnome org>
Date:   Sat Feb 16 14:10:26 2013 +0100

    tree: dup the entry and free it ourselves.
    
    The reason is that we might want to store the item in a list
    and then use it. If we do not keep the ref and entry ourselves
    we get corrupted data.

 libgit2-glib/ggit-tree.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
---
diff --git a/libgit2-glib/ggit-tree.c b/libgit2-glib/ggit-tree.c
index a2914c4..c6a6a50 100644
--- a/libgit2-glib/ggit-tree.c
+++ b/libgit2-glib/ggit-tree.c
@@ -215,7 +215,7 @@ walk_callback_wrapper (const char           *root,
        GgitTreeEntry *wentry;
        WalkInfo *info = (WalkInfo *)payload;
 
-       wentry = _ggit_tree_entry_wrap ((git_tree_entry *)entry, FALSE);
+       wentry = _ggit_tree_entry_wrap (git_tree_entry_dup(entry), TRUE);
 
        ret = info->callback(root, wentry, info->user_data);
 


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