commit:     4307f26db5803a9f73d902bff47cafe25d3e7f1f
Author:     Fabian Groffen <grobian <AT> gentoo <DOT> org>
AuthorDate: Mon Jun 10 08:42:26 2019 +0000
Commit:     Fabian Groffen <grobian <AT> gentoo <DOT> org>
CommitDate: Mon Jun 10 08:42:26 2019 +0000
URL:        https://gitweb.gentoo.org/proj/portage-utils.git/commit/?id=4307f26d

libq/tree: fix crash in tree_open on failure

just free repo, if set, the tree is obviously not there

Signed-off-by: Fabian Groffen <grobian <AT> gentoo.org>

 libq/tree.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/libq/tree.c b/libq/tree.c
index 17f51fc..9dfbe7d 100644
--- a/libq/tree.c
+++ b/libq/tree.c
@@ -114,7 +114,8 @@ tree_open(const char *sroot, const char *portdir)
                return ret;
        }
 
-       tree_close(ret);
+       if (repo != NULL)
+               free(repo);
        warnf("could not open repository at %s (under root %s)", portdir, 
sroot);
 
        return NULL;

Reply via email to