This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project iwhd.git.
The branch, master has been updated
via c63dfdc7d21bc0bd221777621a7649552a8aa40f (commit)
from 491344e55d77c754a8adb70a178bdbef4578675b (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
http://repo.or.cz/w/iwhd.git/commit/c63dfdc7d21bc0bd221777621a7649552a8aa40f
commit c63dfdc7d21bc0bd221777621a7649552a8aa40f
Author: Jeff Darcy <jdarcy(a)redhat.com>
Date: Tue Oct 12 12:34:27 2010 -0400
Fix a memory leak in object-attribute evaluation (found by Jim).
diff --git a/query.c.diff b/query.c.diff
index a63acfa..1442652 100644
--- a/query.c.diff
+++ b/query.c.diff
@@ -1,6 +1,6 @@
---- query-orig.c 2010-10-11 22:45:55.906022513 +0200
-+++ query.c 2010-10-11 22:45:55.909022417 +0200
-@@ -582,7 +582,7 @@ YY_LOCAL(int) yyrefill(void)
+--- query-orig.c 2010-10-12 12:32:09.666434835 -0400
++++ query.c 2010-10-12 12:32:09.692391504 -0400
+@@ -594,7 +594,7 @@ YY_LOCAL(int) yyrefill(void)
while (yybuflen - yypos < 512)
{
yybuflen *= 2;
@@ -9,7 +9,7 @@
}
YY_INPUT((yybuf + yypos), yyn, (yybuflen - yypos));
if (!yyn) return 0;
-@@ -647,7 +647,7 @@ YY_LOCAL(void) yyDo(yyaction action, int
+@@ -659,7 +659,7 @@ YY_LOCAL(void) yyDo(yyaction action, int
while (yythunkpos >= yythunkslen)
{
yythunkslen *= 2;
@@ -18,7 +18,7 @@
}
yythunks[yythunkpos].begin= begin;
yythunks[yythunkpos].end= end;
-@@ -665,7 +665,7 @@ YY_LOCAL(int) yyText(int begin, int end)
+@@ -677,7 +677,7 @@ YY_LOCAL(int) yyText(int begin, int end)
while (yytextlen < (yyleng - 1))
{
yytextlen *= 2;
@@ -27,7 +27,7 @@
}
memcpy(yytext, yybuf + begin, yyleng);
}
-@@ -1203,13 +1203,13 @@ YY_PARSE(int) YYPARSEFROM(yyrule yystart
+@@ -1215,13 +1215,13 @@ YY_PARSE(int) YYPARSEFROM(yyrule yystart
if (!yybuflen)
{
yybuflen= 1024;
diff --git a/query.h b/query.h
index 20a27c9..d541dd7 100644
--- a/query.h
+++ b/query.h
@@ -41,6 +41,7 @@ typedef struct _value {
struct _value *right;
} as_tree;
};
+ char *resolved; /* saved result for T_OFIELD/T_SFIELD/T_LINK */
} value_t;
typedef struct {
diff --git a/query.leg b/query.leg
index 7dd8ee9..1c85e8b 100644
--- a/query.leg
+++ b/query.leg
@@ -84,6 +84,7 @@ make_number (const char *text)
if (tmp) {
tmp->type = T_NUMBER;
tmp->as_num = strtoll(text,NULL,10);
+ tmp->resolved = NULL;
}
return tmp;
@@ -97,6 +98,7 @@ make_string (const char *text, type_t t)
if (tmp) {
tmp->type = t;
tmp->as_str = xstrdup(text);
+ tmp->resolved = NULL;
}
return tmp;
@@ -111,6 +113,7 @@ make_tree (type_t t, value_t *left, value_t *right)
tmp->type = t;
tmp->as_tree.left = left;
tmp->as_tree.right = right;
+ tmp->resolved = NULL;
}
return tmp;
@@ -133,7 +136,7 @@ make_link (value_t *left, value_t *right)
{
char *copy;
- copy = strdup((char *)right);
+ copy = xstrdup((char *)right);
if (!copy) {
return NULL;
}
@@ -158,7 +161,7 @@ unit_oget_func (void * notused, const char *text)
for (i = 0; hacked_obj_fields[i].name; ++i) {
if (!strcmp(hacked_obj_fields[i].name,text)) {
- return hacked_obj_fields[i].value;
+ return xstrdup(hacked_obj_fields[i].value);
}
}
@@ -219,7 +222,10 @@ string_value (value_t *v, getter_t *oget, getter_t *sget)
case T_STRING:
return v->as_str;
case T_OFIELD:
- return oget ? CALL_GETTER(oget,v->as_str) : NULL;
+ if (!v->resolved) {
+ v->resolved = oget ? CALL_GETTER(oget,v->as_str) : NULL;
+ }
+ return v->resolved;
case T_SFIELD:
return sget ? CALL_GETTER(sget,v->as_str) : NULL;
case T_LINK:
@@ -414,6 +420,12 @@ free_value (value_t *v)
return;
}
+ if (v->resolved) {
+ printf("freeing resolved string "%s" (%p)n",
+ v->resolved, v->resolved);
+ }
+ free(v->resolved);
+
switch (v->type) {
case T_STRING:
case T_OFIELD:
-----------------------------------------------------------------------
Summary of changes:
query.c.diff | 12 ++++++------
query.h | 1 +
query.leg | 18 +++++++++++++++---
3 files changed, 22 insertions(+), 9 deletions(-)
repo.or.cz automatic notification. Contact project admin jim(a)meyering.net
if you want to unsubscribe, or site admin admin(a)repo.or.cz if you receive
no reply.
--
iwhd.git ("image warehouse daemon")