summaryrefslogtreecommitdiff
path: root/read_config_file.c
diff options
context:
space:
mode:
authorPetr Machata <pmachata@redhat.com>2013-11-06 11:16:41 +0100
committerChanho Park <chanho61.park@samsung.com>2014-08-22 20:38:23 +0900
commitd7a25b6cf63ae12f4e0c40d463d0b01fbc1e43fc (patch)
tree02b2c7fa9ac269503fc70e750c9dd4e828cdd1a4 /read_config_file.c
parentd71bbd4a9f957f1b9ffdcaee00bc6f030b8ebc27 (diff)
downloadltrace-d7a25b6cf63ae12f4e0c40d463d0b01fbc1e43fc.tar.gz
ltrace-d7a25b6cf63ae12f4e0c40d463d0b01fbc1e43fc.tar.bz2
ltrace-d7a25b6cf63ae12f4e0c40d463d0b01fbc1e43fc.zip
Plug a leak
Diffstat (limited to 'read_config_file.c')
-rw-r--r--read_config_file.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/read_config_file.c b/read_config_file.c
index 980b89b..b59cff4 100644
--- a/read_config_file.c
+++ b/read_config_file.c
@@ -678,6 +678,7 @@ build_printf_pack(struct locus *loc, struct param **packp, size_t param_num)
struct expr_node *node = malloc(sizeof(*node));
if (node == NULL) {
free(*packp);
+ *packp = NULL;
return -1;
}
@@ -1125,12 +1126,19 @@ process_line(struct protolib *plib, struct locus *loc, char *buf)
struct prototype fun;
prototype_init(&fun);
+ struct param *extra_param = NULL;
char *proto_name = NULL;
int own;
fun.return_info = parse_lens(plib, loc, &str, NULL, 0, &own, NULL);
if (fun.return_info == NULL) {
err:
debug(3, " Skipping line %d", loc->line_no);
+
+ if (extra_param != NULL) {
+ param_destroy(extra_param);
+ free(extra_param);
+ }
+
prototype_destroy(&fun);
free(proto_name);
return -1;
@@ -1157,7 +1165,6 @@ process_line(struct protolib *plib, struct locus *loc, char *buf)
str = tmp + 1;
debug(3, " name = %s", proto_name);
- struct param *extra_param = NULL;
int have_stop = 0;
while (1) {
@@ -1235,6 +1242,7 @@ process_line(struct protolib *plib, struct locus *loc, char *buf)
if (extra_param != NULL) {
prototype_push_param(&fun, extra_param);
free(extra_param);
+ extra_param = NULL;
}
if (protolib_add_prototype(plib, proto_name, 1, &fun) < 0) {