summaryrefslogtreecommitdiffstats
path: root/src/lib/event_xml_parser.c
diff options
context:
space:
mode:
authorDenys Vlasenko <dvlasenk@redhat.com>2011-03-09 15:04:04 +0100
committerDenys Vlasenko <dvlasenk@redhat.com>2011-03-09 15:04:04 +0100
commit12afc6905e943f8f358a6e7adcbc7f06ae665787 (patch)
tree474244d224e65c0d9d8099046771147d2b5a1edd /src/lib/event_xml_parser.c
parent93b9b18b5096c7591c02036e1c908f3bcbb09f29 (diff)
downloadabrt-12afc6905e943f8f358a6e7adcbc7f06ae665787.tar.gz
abrt-12afc6905e943f8f358a6e7adcbc7f06ae665787.tar.xz
abrt-12afc6905e943f8f358a6e7adcbc7f06ae665787.zip
fix a leak in event_xml_parser.c; simplify load_conf_file() a bit
Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
Diffstat (limited to 'src/lib/event_xml_parser.c')
-rw-r--r--src/lib/event_xml_parser.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/lib/event_xml_parser.c b/src/lib/event_xml_parser.c
index a0e6c3c4..5f1974fd 100644
--- a/src/lib/event_xml_parser.c
+++ b/src/lib/event_xml_parser.c
@@ -135,13 +135,15 @@ static void text(GMarkupParseContext *context,
ui->name = _text;
return;
}
- if(strcmp(inner_element, DESCRIPTION_ELEMENT) == 0)
+ if (strcmp(inner_element, DESCRIPTION_ELEMENT) == 0)
{
VERB2 log("event description:'%s'", _text);
free(ui->description);
ui->description = _text;
+ return;
}
}
+ free(_text);
}
// Called for strings that should be re-saved verbatim in this same
@@ -186,11 +188,11 @@ void load_event_description_from_file(event_config_t *event_config, const char*
event_config, /*GDestroyNotify:*/ NULL);
FILE* fin = fopen(filename, "r");
- if(fin != NULL)
+ if (fin != NULL)
{
size_t read_bytes = 0;
char buff[1024];
- while ((read_bytes = fread(buff, 1, 1024, fin)))
+ while ((read_bytes = fread(buff, 1, 1024, fin)) != 0)
{
g_markup_parse_context_parse(context, buff, read_bytes, NULL);
}