Hi, 

There were a small memory leak while doing a create, where a split
doesn't match. The patch attached fixes the issue. 

Cheer, 

Francis
>From e0fdc7e7170b1f18ba9f46ad3906e22cd50ef949 Mon Sep 17 00:00:00 2001
From: Francis Giraldeau <[email protected]>
Date: Tue, 20 Jul 2010 10:14:36 -0400
Subject: [PATCH 1/2] FIX memory leak in create when split doesn't match

---
 src/put.c |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)

diff --git a/src/put.c b/src/put.c
index 1a6c607..e6e111b 100644
--- a/src/put.c
+++ b/src/put.c
@@ -226,7 +226,7 @@ static struct split *split_concat(struct state *state, struct lens *lens) {
         count = -1;
     if (count < 0) {
         regexp_match_error(state, lens, count, outer);
-        return NULL;
+        goto error;
     }
 
     struct tree *cur = outer->tree;
@@ -248,6 +248,10 @@ static struct split *split_concat(struct state *state, struct lens *lens) {
     free(regs.start);
     free(regs.end);
     return split;
+ error:
+    free(regs.start);
+    free(regs.end);
+    return NULL;
 }
 
 static struct split *split_iter(struct state *state, struct lens *lens) {
-- 
1.7.0.4

_______________________________________________
augeas-devel mailing list
[email protected]
https://www.redhat.com/mailman/listinfo/augeas-devel

Reply via email to