Blob Blame History Raw
From 095005bc98e28df6abcbb75dccfbbfa59d7b440d Mon Sep 17 00:00:00 2001
From: Pino Toscano <ptoscano@redhat.com>
Date: Fri, 20 Jul 2018 16:25:33 +0200
Subject: [PATCH] * src/pathx.c (parse_location_path): fix memleak on error

If parse_relative_location_path fails, then the early return will leak
locpath.  Use the common error handling to cleanup all the resources.

(cherry picked from commit b8dc554919827d70a6d24b054da463254164dca2)
---
 src/pathx.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/pathx.c b/src/pathx.c
index 48c8b0b1..bd0fe2e3 100644
--- a/src/pathx.c
+++ b/src/pathx.c
@@ -1971,7 +1971,7 @@ static void parse_location_path(struct state *state) {
             state->pos += 1;
             locpath = parse_relative_location_path(state);
             if (HAS_ERROR(state))
-                return;
+                goto error;
             struct step *step = make_step(DESCENDANT_OR_SELF, state);
             if (HAS_ERROR(state))
                 goto error;
-- 
2.17.2