On Wed, Sep 12, 2007 at 06:13:43PM +0200, Martin Zobel-Helas wrote:
> I heared from Otavio, that there was a testing image was produced and
> reported to work fine, so please go ahead.
Attached is the proposed patch updating cdebconf to version 0.114etch1.
With these changes, on a usual installation on amd64, I have observed
a 12 Mb difference in memory usage at the end of the process.
Cheers,
--
Jérémy Bobbio .''`.
lunar@debian.org : :Ⓐ : # apt-get install anarchism
`. `'`
`-
diff -Nru /tmp/xwalyA0i1H/cdebconf-0.114/debian/changelog /tmp/DNEzBXmMOx/cdebconf-0.114etch1/debian/changelog
--- /tmp/xwalyA0i1H/cdebconf-0.114/debian/changelog 2007-02-27 16:40:12.000000000 +0100
+++ /tmp/DNEzBXmMOx/cdebconf-0.114etch1/debian/changelog 2007-09-07 13:18:17.000000000 +0200
@@ -1,3 +1,13 @@
+cdebconf (0.114etch1) etch; urgency=low
+
+ [ Colin Watson ]
+ * Fix off-by-one error reading from confmodule (thanks, Baruch Even;
+ closes: #430108).
+ * Fix a bunch of reference-counting bugs and other memory leaks.
+ * Fix another (large!) memory leak: parsed RFC822 stanzas were never freed.
+
+ -- Jérémy Bobbio <lunar@debian.org> Fri, 07 Sep 2007 13:08:17 +0200
+
cdebconf (0.114) unstable; urgency=low
[ Attilio Fiandrotti ]
diff -Nru /tmp/xwalyA0i1H/cdebconf-0.114/src/commands.c /tmp/DNEzBXmMOx/cdebconf-0.114etch1/src/commands.c
--- /tmp/xwalyA0i1H/cdebconf-0.114/src/commands.c 2006-09-23 15:23:29.000000000 +0200
+++ /tmp/DNEzBXmMOx/cdebconf-0.114etch1/src/commands.c 2007-09-07 13:16:53.000000000 +0200
@@ -395,8 +395,9 @@
}
question_owner_add(q, mod->owner);
q->template = t;
- template_ref(t);
+ /* steal reference from mod->templates->methods.get above */
mod->questions->methods.set(mod->questions, q);
+ question_deref(q);
asprintf(&out, "%u", CMDSTATUS_SUCCESS);
return out;
}
@@ -418,6 +419,7 @@
return out;
}
question_owner_delete(q, mod->owner);
+ question_deref(q);
asprintf(&out, "%u", CMDSTATUS_SUCCESS);
return out;
@@ -458,6 +460,8 @@
asprintf(&out, "%u %s", CMDSTATUS_SUCCESS, value);
free(value);
+ question_deref(q);
+
return out;
}
@@ -596,6 +600,7 @@
if (*argv[1])
question_owner_add(q, argv[1]);
mod->questions->methods.set(mod->questions, q);
+ question_deref(q);
t = t->next;
}
asprintf(&out, "%u OK", CMDSTATUS_SUCCESS);
@@ -638,6 +643,7 @@
return out;
}
value = question_get_field(q, "", "description");
+ question_deref(q);
if (value == NULL)
{
asprintf(&out, "%u %s description field does not exist",
@@ -681,6 +687,7 @@
return out;
}
value = question_get_field(q, "", "description");
+ question_deref(q);
if (value == NULL)
{
asprintf(&out, "%u %s description field does not exist",
@@ -723,6 +730,7 @@
return out;
}
value = question_get_field(q, "", "description");
+ question_deref(q);
if (value == NULL)
{
asprintf(&out, "%u %s description field does not exist",
@@ -774,6 +782,7 @@
return out;
}
mod->frontend->methods.info(mod->frontend, q);
+ question_deref(q);
asprintf(&out, "%u OK", CMDSTATUS_SUCCESS);
return out;
@@ -814,9 +823,11 @@
}
t->lset(t, NULL, item, value);
mod->questions->methods.set(mod->questions, q);
+ question_deref(q);
}
else
t->lset(t, NULL, item, value);
+ template_deref(t);
asprintf(&out, "%u OK", CMDSTATUS_SUCCESS);
return out;
diff -Nru /tmp/xwalyA0i1H/cdebconf-0.114/src/configuration.c /tmp/DNEzBXmMOx/cdebconf-0.114etch1/src/configuration.c
--- /tmp/xwalyA0i1H/cdebconf-0.114/src/configuration.c 2006-07-26 00:50:03.000000000 +0200
+++ /tmp/DNEzBXmMOx/cdebconf-0.114etch1/src/configuration.c 2007-09-07 13:09:29.000000000 +0200
@@ -181,6 +181,7 @@
unsigned int stackpos = 0;
int curline = 0, i;
int incomment = 0, inquote = 0;
+ int ret = DC_OK;
linebuf[0] = 0;
parenttag[0] = 0;
@@ -309,7 +310,8 @@
if (termchar == '{' && linebuf[0] == 0)
{
INFO(INFO_ERROR, "Syntax error %s:%u: block starts with no name", filename, curline);
- return DC_NOTOK;
+ ret = DC_NOTOK;
+ goto out;
}
if (linebuf[0] == 0)
@@ -331,7 +333,8 @@
&& strparsequoteword(&q, tag, sizeof(tag)) == 0)
{
INFO(INFO_ERROR, "Syntax error %s:%u: Malformed tag", filename, curline);
- return DC_NOTOK;
+ ret = DC_NOTOK;
+ goto out;
}
/* parse off the value */
@@ -350,15 +353,18 @@
if (strlen(q) != 0)
{
INFO(INFO_ERROR, "Syntax error %s:%u: Extra junk after tag", filename, curline);
- return DC_NOTOK;
+ ret = DC_NOTOK;
+ goto out;
}
if (termchar == '{')
{
/* 99, not 100. 100 gives possible
off-by-one error */
- if (stackpos <= 99)
+ if (stackpos <= 99) {
+ DELETE(stack[stackpos]);
stack[stackpos++] = strdup(parenttag);
+ }
if (value[0] != 0)
{
strvacat(tag, sizeof(tag),
@@ -423,8 +429,11 @@
strvacat(linebuf, sizeof(linebuf), " ", (char *) 0);
strcat(linebuf, buf);
}
+out:
fclose(infp);
- return DC_OK;
+ for (i = 0; i < DIM(stack); i++)
+ DELETE(stack[i]);
+ return ret;
}
static void config_dump(struct configuration *cfg)
@@ -489,6 +498,8 @@
while (top != 0 && top->next == 0)
{
next = top->parent;
+ DELETE(top->tag);
+ DELETE(top->value);
DELETE(top);
top = next;
}
@@ -496,8 +507,12 @@
if (top != 0)
{
next = top->next;
+ DELETE(top->tag);
+ DELETE(top->value);
DELETE(top);
top = next;
}
}
+
+ DELETE(config);
}
diff -Nru /tmp/xwalyA0i1H/cdebconf-0.114/src/confmodule.c /tmp/DNEzBXmMOx/cdebconf-0.114etch1/src/confmodule.c
--- /tmp/xwalyA0i1H/cdebconf-0.114/src/confmodule.c 2006-07-26 00:50:03.000000000 +0200
+++ /tmp/DNEzBXmMOx/cdebconf-0.114etch1/src/confmodule.c 2007-09-07 13:08:04.000000000 +0200
@@ -84,7 +84,7 @@
return DC_OK;
}
- ret = read(mod->infd, buf, sizeof(buf));
+ ret = read(mod->infd, buf, sizeof(buf) - 1);
if (ret < 0) {
if (errno == EINTR)
continue;
diff -Nru /tmp/xwalyA0i1H/cdebconf-0.114/src/database.c /tmp/DNEzBXmMOx/cdebconf-0.114etch1/src/database.c
--- /tmp/xwalyA0i1H/cdebconf-0.114/src/database.c 2006-07-26 00:50:03.000000000 +0200
+++ /tmp/DNEzBXmMOx/cdebconf-0.114etch1/src/database.c 2007-09-07 13:14:42.000000000 +0200
@@ -132,7 +132,7 @@
const char *modpath, *modname, *driver;
if (instance != NULL) {
- modname = strdup(instance);
+ modname = instance;
} else {
modname = cfg->get(cfg, "global::default::template", getenv("DEBCONF_TEMPLATE"));
}
@@ -161,7 +161,7 @@
db = NEW(struct template_db);
memset(db, 0, sizeof(struct template_db));
db->handle = dlh;
- db->modname = modname;
+ db->modname = STRDUP(modname);
db->data = NULL;
db->config = cfg;
snprintf(db->configpath, sizeof(db->configpath),
@@ -197,6 +197,7 @@
void template_db_delete(struct template_db *db)
{
db->methods.shutdown(db);
+ free(db->modname);
dlclose(db->handle);
DELETE(db);
@@ -377,7 +378,7 @@
const char *modpath, *driver, *modname = NULL;
if (instance != NULL)
- modname = strdup(instance);
+ modname = instance;
if (modname == NULL)
modname = getenv("DEBCONF_CONFIG");
@@ -409,7 +410,7 @@
db = NEW(struct question_db);
memset(db, 0, sizeof(struct question_db));
db->handle = dlh;
- db->modname = modname;
+ db->modname = STRDUP(modname);
db->data = NULL;
db->config = cfg;
db->tdb = tdb;
@@ -449,6 +450,7 @@
void question_db_delete(struct question_db *db)
{
db->methods.shutdown(db);
+ free(db->modname);
dlclose(db->handle);
DELETE(db);
diff -Nru /tmp/xwalyA0i1H/cdebconf-0.114/src/database.h /tmp/DNEzBXmMOx/cdebconf-0.114etch1/src/database.h
--- /tmp/xwalyA0i1H/cdebconf-0.114/src/database.h 2006-07-26 00:50:03.000000000 +0200
+++ /tmp/DNEzBXmMOx/cdebconf-0.114etch1/src/database.h 2007-09-07 13:15:45.000000000 +0200
@@ -57,7 +57,7 @@
*/
struct template_db {
/** db module name */
- const char *modname;
+ char *modname;
/** db module handle */
void *handle;
/** configuration data */
@@ -76,7 +76,7 @@
*/
struct question_db {
/** db module name */
- const char *modname;
+ char *modname;
/** db module handle */
void *handle;
/** configuration data */
diff -Nru /tmp/xwalyA0i1H/cdebconf-0.114/src/debconf-loadtemplate.c /tmp/DNEzBXmMOx/cdebconf-0.114etch1/src/debconf-loadtemplate.c
--- /tmp/xwalyA0i1H/cdebconf-0.114/src/debconf-loadtemplate.c 2006-09-23 15:23:29.000000000 +0200
+++ /tmp/DNEzBXmMOx/cdebconf-0.114etch1/src/debconf-loadtemplate.c 2007-09-07 13:09:29.000000000 +0200
@@ -122,6 +122,8 @@
if (tdb->methods.set(tdb, t) != DC_OK)
INFO(INFO_ERROR, "Cannot add template %s", t->tag);
}
+ if (oldt)
+ template_deref(oldt);
q = qdb->methods.get(qdb, t->tag);
if (q == NULL)
@@ -140,7 +142,9 @@
if (qdb->methods.set(qdb, q) != DC_OK)
INFO(INFO_ERROR, "Cannot add config %s", t->tag);
question_deref(q);
+ oldt = t;
t = t->next;
+ template_deref(oldt);
}
}
diff -Nru /tmp/xwalyA0i1H/cdebconf-0.114/src/frontend.c /tmp/DNEzBXmMOx/cdebconf-0.114etch1/src/frontend.c
--- /tmp/xwalyA0i1H/cdebconf-0.114/src/frontend.c 2006-07-26 00:50:03.000000000 +0200
+++ /tmp/DNEzBXmMOx/cdebconf-0.114etch1/src/frontend.c 2007-09-07 13:09:29.000000000 +0200
@@ -83,6 +83,7 @@
{
question_deref(f->info);
f->info = info;
+ question_ref(info);
}
static bool frontend_can_go_back(struct frontend *ui, struct question *q)
@@ -232,10 +233,10 @@
obj->methods.shutdown(obj);
if (obj->handle != NULL)
dlclose(obj->handle);
- DELETE(obj->questions);
+ frontend_clear(obj);
DELETE(obj->capb);
DELETE(obj->title);
- DELETE(obj->info);
+ question_deref(obj->info);
DELETE(obj->progress_title);
DELETE(obj->plugin_path);
DELETE(obj);
diff -Nru /tmp/xwalyA0i1H/cdebconf-0.114/src/modules/db/http/http.c /tmp/DNEzBXmMOx/cdebconf-0.114etch1/src/modules/db/http/http.c
--- /tmp/xwalyA0i1H/cdebconf-0.114/src/modules/db/http/http.c 2006-07-26 00:49:59.000000000 +0200
+++ /tmp/DNEzBXmMOx/cdebconf-0.114etch1/src/modules/db/http/http.c 2007-09-07 13:17:38.000000000 +0200
@@ -208,6 +208,22 @@
return DC_OK;
}
+static int http_template_shutdown(struct template_db *db)
+{
+ struct template_db_cache *dbdata = db->data;
+ struct template *t;
+
+ while (dbdata->templates != NULL)
+ {
+ t = dbdata->templates;
+ dbdata->templates = dbdata->templates->next;
+ t->next = NULL;
+ template_deref(t);
+ }
+
+ return DC_OK;
+}
+
static int http_template_set(struct template_db *db, struct template *t)
{
return DC_NOTIMPL;
@@ -280,6 +296,22 @@
return DC_OK;
}
+static int http_question_shutdown(struct question_db *db)
+{
+ struct question_db_cache *dbdata = db->data;
+ struct question *q;
+
+ while (dbdata->questions != NULL)
+ {
+ q = dbdata->questions;
+ dbdata->questions = dbdata->questions->next;
+ q->next = q->prev = NULL;
+ question_deref(q);
+ }
+
+ return DC_OK;
+}
+
static int http_question_set(struct question_db *db, struct question *q)
{
return DC_NOTIMPL;
@@ -327,7 +359,7 @@
if (name == NULL || *name == 0)
{
INFO(INFO_ERROR, "Read a stanza without a name");
- DELETE(header);
+ rfc822_header_destroy(header);
continue;
}
@@ -342,7 +374,7 @@
tmp->template = template_new(name);
db->tdb->methods.set(db->tdb, tmp->template);
}
- DELETE(header);
+ rfc822_header_destroy(header);
}
fclose(inf);
@@ -363,6 +395,7 @@
struct template_db_module debconf_template_db_module = {
initialize: http_template_initialize,
+ shutdown: http_template_shutdown,
set: http_template_set,
get: http_template_get,
remove: http_template_remove,
@@ -371,6 +404,7 @@
struct question_db_module debconf_question_db_module = {
initialize: http_question_initialize,
+ shutdown: http_question_shutdown,
set: http_question_set,
get: http_question_get,
disown: http_question_disown,
diff -Nru /tmp/xwalyA0i1H/cdebconf-0.114/src/modules/db/rfc822db/rfc822db.c /tmp/DNEzBXmMOx/cdebconf-0.114etch1/src/modules/db/rfc822db/rfc822db.c
--- /tmp/xwalyA0i1H/cdebconf-0.114/src/modules/db/rfc822db/rfc822db.c 2006-09-23 15:23:28.000000000 +0200
+++ /tmp/DNEzBXmMOx/cdebconf-0.114etch1/src/modules/db/rfc822db/rfc822db.c 2007-09-07 13:17:38.000000000 +0200
@@ -22,6 +22,9 @@
FILE *outf = NULL;
+static struct template *rfc822db_template_get(struct template_db *db,
+ const char *ltag);
+
int nodetemplatecomp(const void *pa, const void *pb) {
return strcmp(((struct template *)pa)->tag,
((struct template *)pb)->tag);
@@ -125,6 +128,11 @@
return ret;
}
+void rfc822db_template_destroyitem(void *data)
+{
+ template_deref((struct template *) data);
+}
+
/* templates */
static int rfc822db_template_initialize(struct template_db *db, struct configuration *cfg)
{
@@ -142,6 +150,20 @@
return DC_OK;
}
+static int rfc822db_template_shutdown(struct template_db *db)
+{
+ struct template_db_cache *dbdata = db->data;
+ if (dbdata == NULL)
+ return DC_OK;
+ if (dbdata->root)
+ tdestroy(dbdata->root, rfc822db_template_destroyitem);
+ if (dbdata->iterator)
+ di_slist_destroy(dbdata->iterator, rfc822db_template_destroyitem);
+ free(dbdata);
+ db->data = NULL;
+ return DC_OK;
+}
+
/*
* Function: rfc822db_template_load
* Input: template database
@@ -176,7 +198,7 @@
if (name == NULL)
{
INFO(INFO_ERROR, "Read a stanza without a name");
- DELETE(header);
+ rfc822_header_destroy(header);
continue;
}
@@ -187,6 +209,7 @@
tmp->next = NULL;
tsearch(tmp, &dbdata->root, nodetemplatecomp);
+ rfc822_header_destroy(header);
}
fclose(inf);
@@ -356,11 +379,6 @@
template_dup(*(struct template **) nodep));
}
-void rfc822db_template_destroyiterator(void *data)
-{
- template_deref((struct template *) data);
-}
-
static struct template *rfc822db_template_iterate(struct template_db *db,
void **iter)
{
@@ -373,8 +391,7 @@
node = *(di_slist_node **) iter;
if (node == NULL) {
if (dbdata->iterator)
- di_slist_destroy(dbdata->iterator,
- rfc822db_template_destroyiterator);
+ di_slist_destroy(dbdata->iterator, rfc822db_template_destroyitem);
dbdata->iterator = di_slist_alloc();
template_iterator = dbdata->iterator; /* non-thread-safe */
twalk(dbdata->root, rfc822db_template_makeiterator);
@@ -384,7 +401,7 @@
*iter = node = node->next;
if (node == NULL) {
- di_slist_destroy(dbdata->iterator, rfc822db_template_destroyiterator);
+ di_slist_destroy(dbdata->iterator, rfc822db_template_destroyitem);
dbdata->iterator = NULL;
return NULL;
}
@@ -394,6 +411,11 @@
return t;
}
+void rfc822db_question_destroyitem(void *data)
+{
+ question_deref((struct question *) data);
+}
+
/* config database */
static int rfc822db_question_initialize(struct question_db *db, struct configuration *cfg)
{
@@ -412,6 +434,20 @@
return DC_OK;
}
+static int rfc822db_question_shutdown(struct question_db *db)
+{
+ struct question_db_cache *dbdata = db->data;
+ if (dbdata == NULL)
+ return DC_OK;
+ if (dbdata->root)
+ tdestroy(dbdata->root, rfc822db_question_destroyitem);
+ if (dbdata->iterator)
+ di_slist_destroy(dbdata->iterator, rfc822db_question_destroyitem);
+ free(dbdata);
+ db->data = NULL;
+ return DC_OK;
+}
+
/*
* Function: rfc822db_question_load
* Input: question database
@@ -450,7 +486,7 @@
if (name == NULL || *name == 0)
{
INFO(INFO_ERROR, "Read a stanza without a name");
- DELETE(header);
+ rfc822_header_destroy(header);
continue;
}
@@ -466,7 +502,7 @@
db->tdb->methods.set(db->tdb, tmp->template);
}
tsearch(tmp, &dbdata->root, nodequestioncomp);
- DELETE(header);
+ rfc822_header_destroy(header);
}
fclose(inf);
@@ -668,11 +704,6 @@
question_dup(*(struct question **) nodep));
}
-void rfc822db_question_destroyiterator(void *data)
-{
- question_deref((struct question *) data);
-}
-
static struct question *rfc822db_question_iterate(struct question_db *db,
void **iter)
{
@@ -685,8 +716,7 @@
node = *(di_slist_node **) iter;
if (node == NULL) {
if (dbdata->iterator)
- di_slist_destroy(dbdata->iterator,
- rfc822db_question_destroyiterator);
+ di_slist_destroy(dbdata->iterator, rfc822db_question_destroyitem);
dbdata->iterator = di_slist_alloc();
question_iterator = dbdata->iterator; /* non-thread-safe */
twalk(dbdata->root, rfc822db_question_makeiterator);
@@ -696,7 +726,7 @@
*iter = node = node->next;
if (node == NULL) {
- di_slist_destroy(dbdata->iterator, rfc822db_question_destroyiterator);
+ di_slist_destroy(dbdata->iterator, rfc822db_question_destroyitem);
dbdata->iterator = NULL;
return NULL;
}
@@ -708,6 +738,7 @@
struct template_db_module debconf_template_db_module = {
initialize: rfc822db_template_initialize,
+ shutdown: rfc822db_template_shutdown,
load: rfc822db_template_load,
save: rfc822db_template_save,
set: rfc822db_template_set,
@@ -718,6 +749,7 @@
struct question_db_module debconf_question_db_module = {
initialize: rfc822db_question_initialize,
+ shutdown: rfc822db_question_shutdown,
load: rfc822db_question_load,
save: rfc822db_question_save,
set: rfc822db_question_set,
diff -Nru /tmp/xwalyA0i1H/cdebconf-0.114/src/modules/db/stack/stack.c /tmp/DNEzBXmMOx/cdebconf-0.114etch1/src/modules/db/stack/stack.c
--- /tmp/xwalyA0i1H/cdebconf-0.114/src/modules/db/stack/stack.c 2006-07-26 00:49:59.000000000 +0200
+++ /tmp/DNEzBXmMOx/cdebconf-0.114etch1/src/modules/db/stack/stack.c 2007-09-07 13:09:29.000000000 +0200
@@ -85,10 +85,8 @@
struct template_stack *tstack = (struct template_stack *)db->data;
while (tstack) {
struct template_stack *next = tstack->next;
- if (tstack->db->methods.shutdown(tstack->db) != DC_OK)
- return DC_NOTOK;
- dlclose(tstack->db->handle);
- DELETE(tstack->db);
+ template_db_delete(tstack->db);
+ DELETE(tstack);
tstack = next;
}
return DC_OK;
@@ -250,10 +248,8 @@
struct question_stack *qstack = (struct question_stack *)db->data;
while (qstack) {
struct question_stack *next = qstack->next;
- if (qstack->db->methods.shutdown(qstack->db) != DC_OK)
- return DC_NOTOK;
- dlclose(qstack->db->handle);
- DELETE(qstack->db);
+ question_db_delete(qstack->db);
+ DELETE(qstack);
qstack = next;
}
return DC_OK;
diff -Nru /tmp/xwalyA0i1H/cdebconf-0.114/src/modules/db/textdb/textdb.c /tmp/DNEzBXmMOx/cdebconf-0.114etch1/src/modules/db/textdb/textdb.c
--- /tmp/xwalyA0i1H/cdebconf-0.114/src/modules/db/textdb/textdb.c 2006-09-23 15:23:28.000000000 +0200
+++ /tmp/DNEzBXmMOx/cdebconf-0.114etch1/src/modules/db/textdb/textdb.c 2007-09-07 13:09:29.000000000 +0200
@@ -114,6 +114,22 @@
return DC_OK;
}
+static int textdb_template_shutdown(struct template_db *db)
+{
+ struct template_db_cache *dbdata = db->data;
+ struct template *t;
+
+ while (dbdata->templates != NULL)
+ {
+ t = dbdata->templates;
+ dbdata->templates = dbdata->templates->next;
+ t->next = NULL;
+ template_deref(t);
+ }
+
+ return DC_OK;
+}
+
static int textdb_template_set(struct template_db *db, struct template *t)
{
FILE *outf;
@@ -275,6 +291,22 @@
return DC_OK;
}
+static int textdb_question_shutdown(struct question_db *db)
+{
+ struct question_db_cache *dbdata = db->data;
+ struct question *q;
+
+ while (dbdata->questions != NULL)
+ {
+ q = dbdata->questions;
+ dbdata->questions = dbdata->questions->next;
+ q->next = q->prev = NULL;
+ question_deref(q);
+ }
+
+ return DC_OK;
+}
+
static int textdb_question_set(struct question_db *db, struct question *q)
{
FILE *outf;
@@ -446,6 +478,7 @@
struct template_db_module debconf_template_db_module = {
initialize: textdb_template_initialize,
+ shutdown: textdb_template_shutdown,
set: textdb_template_set,
get: textdb_template_get,
remove: textdb_template_remove,
@@ -454,6 +487,7 @@
struct question_db_module debconf_question_db_module = {
initialize: textdb_question_initialize,
+ shutdown: textdb_question_shutdown,
set: textdb_question_set,
get: textdb_question_get,
disown: textdb_question_disown,
diff -Nru /tmp/xwalyA0i1H/cdebconf-0.114/src/question.c /tmp/DNEzBXmMOx/cdebconf-0.114etch1/src/question.c
--- /tmp/xwalyA0i1H/cdebconf-0.114/src/question.c 2006-09-23 15:23:29.000000000 +0200
+++ /tmp/DNEzBXmMOx/cdebconf-0.114etch1/src/question.c 2007-09-07 13:09:29.000000000 +0200
@@ -22,8 +22,18 @@
void question_delete(struct question *question)
{
+ struct questionowner **ownerp;
+
+ DELETE(question->tag);
if (question->template)
template_deref(question->template);
+ for (ownerp = &question->owners; *ownerp != NULL;)
+ {
+ struct questionowner *currentp = *ownerp;
+ *ownerp = currentp->next;
+ DELETE(currentp->owner);
+ DELETE(currentp);
+ }
if (question->priority != NULL)
free(question->priority);
DELETE(question);
diff -Nru /tmp/xwalyA0i1H/cdebconf-0.114/src/rfc822.c /tmp/DNEzBXmMOx/cdebconf-0.114etch1/src/rfc822.c
--- /tmp/xwalyA0i1H/cdebconf-0.114/src/rfc822.c 2006-07-26 00:50:03.000000000 +0200
+++ /tmp/DNEzBXmMOx/cdebconf-0.114etch1/src/rfc822.c 2007-09-07 13:17:38.000000000 +0200
@@ -102,3 +102,17 @@
/* fprintf(stderr,"rfc822_header_lookup returning: '%s'\n", list->value);*/
return list->value;
}
+
+
+void rfc822_header_destroy(struct rfc822_header *list)
+{
+ struct rfc822_header *cur = list, *next;
+
+ while (cur) {
+ free(cur->header);
+ free(cur->value);
+ next = cur->next;
+ DELETE(cur);
+ cur = next;
+ }
+}
diff -Nru /tmp/xwalyA0i1H/cdebconf-0.114/src/rfc822.h /tmp/DNEzBXmMOx/cdebconf-0.114etch1/src/rfc822.h
--- /tmp/xwalyA0i1H/cdebconf-0.114/src/rfc822.h 2006-07-26 00:50:03.000000000 +0200
+++ /tmp/DNEzBXmMOx/cdebconf-0.114etch1/src/rfc822.h 2007-09-07 13:17:38.000000000 +0200
@@ -9,4 +9,5 @@
struct rfc822_header *rfc822_parse_stanza(FILE *file);
char *rfc822_header_lookup(struct rfc822_header *list, const char* key);
+void rfc822_header_destroy(struct rfc822_header *list);
#endif
diff -Nru /tmp/xwalyA0i1H/cdebconf-0.114/src/template.c /tmp/DNEzBXmMOx/cdebconf-0.114etch1/src/template.c
--- /tmp/xwalyA0i1H/cdebconf-0.114/src/template.c 2006-09-23 15:23:29.000000000 +0200
+++ /tmp/DNEzBXmMOx/cdebconf-0.114etch1/src/template.c 2007-09-07 13:09:29.000000000 +0200
@@ -134,6 +134,7 @@
while (p != NULL)
{
q = p->next;
+ DELETE(p->language);
DELETE(p->defaultval);
DELETE(p->choices);
DELETE(p->indices);
Attachment:
signature.asc
Description: Digital signature