aboutsummaryrefslogtreecommitdiffstats
path: root/common/t-iobuf.c
diff options
context:
space:
mode:
authorJustus Winter <[email protected]>2016-06-28 15:59:17 +0000
committerJustus Winter <[email protected]>2016-06-28 16:21:50 +0000
commitc14ef10fc347d966a1efcb5c2000cbf3aaafa905 (patch)
treee36f40e1fe5672dcb1e38172559c0b431e1a9367 /common/t-iobuf.c
parentdirmngr: add option to retrieve extra WKS info. (diff)
downloadgnupg-c14ef10fc347d966a1efcb5c2000cbf3aaafa905.tar.gz
gnupg-c14ef10fc347d966a1efcb5c2000cbf3aaafa905.zip
common: Fix memory leaks.
* common/ccparray.c (ccparray_put): Free old array. * common/stringhelp.c (do_make_filename): Free 'home'. * common/t-convert.c: Fix trivial memory leaks. * common/t-iobuf.c: Likewise. * common/t-mbox-util.c: Likewise. * common/t-name-value.c: Likewise. * common/t-stringhelp.c: Likewise. * common/t-strlist.c: Likewise. Signed-off-by: Justus Winter <[email protected]>
Diffstat (limited to 'common/t-iobuf.c')
-rw-r--r--common/t-iobuf.c15
1 files changed, 14 insertions, 1 deletions
diff --git a/common/t-iobuf.c b/common/t-iobuf.c
index 2835df4d2..0e6f508a5 100644
--- a/common/t-iobuf.c
+++ b/common/t-iobuf.c
@@ -190,6 +190,8 @@ main (int argc, char *argv[])
n ++;
}
assert (n == 10 + (strlen (content) - 10) / 2);
+
+ iobuf_close (iobuf);
}
@@ -266,6 +268,8 @@ main (int argc, char *argv[])
/* The string should have been truncated (max_len == 0). */
assert (max_len == 0);
free (buffer);
+
+ iobuf_close (iobuf);
}
{
@@ -279,10 +283,12 @@ main (int argc, char *argv[])
int c;
int n;
int lastc = 0;
+ struct content_filter_state *state;
iobuf = iobuf_temp_with_content (content, strlen(content));
rc = iobuf_push_filter (iobuf,
- content_filter, content_filter_new (content2));
+ content_filter,
+ state=content_filter_new (content2));
assert (rc == 0);
n = 0;
@@ -309,6 +315,9 @@ main (int argc, char *argv[])
/* printf ("%d: '%c' (%d)\n", n, c, c); */
}
}
+
+ iobuf_close (iobuf);
+ free (state);
}
/* Write some data to a temporary filter. Push a new filter. The
@@ -346,6 +355,8 @@ main (int argc, char *argv[])
assert (n == strlen (content) + 2 * (strlen (content2) + 1));
assert (strcmp (buffer, "0123456789aabbcc") == 0);
+
+ iobuf_close (iobuf);
}
{
@@ -373,6 +384,8 @@ main (int argc, char *argv[])
assert (n == 2);
assert (buffer[0] == '3');
assert (buffer[1] == '7');
+
+ iobuf_close (iobuf);
}
return 0;