[augeas-devel] [PATCH] Fix ref counting error in lns_make_plus
David Lutterkort
dlutter at redhat.com
Fri Apr 25 03:56:09 UTC 2008
# HG changeset patch
# User David Lutterkort <dlutter at redhat.com>
# Date 1209095747 25200
# Node ID ffcd7c0fe252e10eb7bc500ee879ad2bcc1beb7c
# Parent 7e13b29c1a1b0316b5fdf28751bd7419e2bf9f5f
Fix ref counting error in lns_make_plus
We burnt the passed-in ownership of L when constructing STAR; also, since
we unref STAR at the end, we need to take ownership of STAR->LENS when
constructing the concat of L and STAR->LENS
diff -r 7e13b29c1a1b -r ffcd7c0fe252 src/lens.c
--- a/src/lens.c Thu Apr 24 13:58:43 2008 -0700
+++ b/src/lens.c Thu Apr 24 20:55:47 2008 -0700
@@ -180,7 +180,7 @@ struct value *lns_make_plus(struct info
if (EXN(star))
return star;
- conc = lns_make_concat(ref(info), l, star->lens, check);
+ conc = lns_make_concat(ref(info), ref(l), ref(star->lens), check);
unref(star, value);
return conc;
}
diff -r 7e13b29c1a1b -r ffcd7c0fe252 src/lens.h
--- a/src/lens.h Thu Apr 24 13:58:43 2008 -0700
+++ b/src/lens.h Thu Apr 24 20:55:47 2008 -0700
@@ -27,7 +27,7 @@
#include "fa.h"
enum lens_tag {
- L_DEL,
+ L_DEL = 42, /* Shift tag values so we fail fast(er) on bad pointers */
L_STORE,
L_KEY,
L_LABEL,
diff -r 7e13b29c1a1b -r ffcd7c0fe252 tests/modules/pass_lens_plus.aug
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/modules/pass_lens_plus.aug Thu Apr 24 20:55:47 2008 -0700
@@ -0,0 +1,11 @@
+module Pass_lens_plus =
+
+ let a = [ key /a/ ]
+ let lns = a+
+
+ test lns put "a" after rm "x" = "a"
+
+
+(* Local Variables: *)
+(* mode: caml *)
+(* End: *)
More information about the augeas-devel
mailing list