summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author/C=EU/ST=EU/CN=Pablo Neira Ayuso/emailAddress=pablo@netfilter.org </C=EU/ST=EU/CN=Pablo Neira Ayuso/emailAddress=pablo@netfilter.org>2008-01-17 17:12:49 +0000
committer/C=EU/ST=EU/CN=Pablo Neira Ayuso/emailAddress=pablo@netfilter.org </C=EU/ST=EU/CN=Pablo Neira Ayuso/emailAddress=pablo@netfilter.org>2008-01-17 17:12:49 +0000
commitab4f7c0abd2d42f20b8675b3bc552a88204ce4ad (patch)
tree97f40ed93139f6552f890aab570cabc65004c7ae
parenta156e55302d7ce35234b6075124d2b5ed4037c89 (diff)
downloadconntrack-tools-ab4f7c0abd2d42f20b8675b3bc552a88204ce4ad.tar.gz
conntrack-tools-ab4f7c0abd2d42f20b8675b3bc552a88204ce4ad.zip
Max Kellermann <max@duempel.org>:
add buffer_destroy() to buffer.c
-rw-r--r--ChangeLog1
-rw-r--r--include/buffer.h2
-rw-r--r--src/buffer.c6
3 files changed, 9 insertions, 0 deletions
diff --git a/ChangeLog b/ChangeLog
index 9fbfa71..3d53d51 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -75,6 +75,7 @@ o always close stdin - even in non-daemon mode, it is of no use
o chdir("/") to release the cwd inode
o ignore setsid() failure, because there is only one possible and
o fix harmless error condition
+o add buffer_destroy() to buffer.c
version 0.9.5 (2007/07/29)
------------------------------
diff --git a/include/buffer.h b/include/buffer.h
index aa753b4..0d52e72 100644
--- a/include/buffer.h
+++ b/include/buffer.h
@@ -8,6 +8,8 @@ struct buffer {
};
struct buffer *buffer_create(unsigned int size);
+void buffer_destroy(struct buffer *b);
+
int buffer_add(struct buffer *b, void *data, unsigned int size);
void buffer_flush(struct buffer *b,
void (*cb)(void *buffer_data,
diff --git a/src/buffer.c b/src/buffer.c
index 79266a7..adde81c 100644
--- a/src/buffer.c
+++ b/src/buffer.c
@@ -41,6 +41,12 @@ struct buffer *buffer_create(unsigned int size)
return b;
}
+void buffer_destroy(struct buffer *b)
+{
+ free(b->data);
+ free(b);
+}
+
int buffer_add(struct buffer *b, void *data, unsigned int size)
{
if (b->size - b->cur_size < size) {