summaryrefslogtreecommitdiff
path: root/libblkid-tiny/probe.c
diff options
context:
space:
mode:
Diffstat (limited to 'libblkid-tiny/probe.c')
-rw-r--r--libblkid-tiny/probe.c23
1 files changed, 23 insertions, 0 deletions
diff --git a/libblkid-tiny/probe.c b/libblkid-tiny/probe.c
index 54e22dc..ae7e708 100644
--- a/libblkid-tiny/probe.c
+++ b/libblkid-tiny/probe.c
@@ -9,8 +9,11 @@
#include <stdlib.h>
+#include "blkidP.h"
#include "libblkid-tiny.h"
+static int blkid_probe_reset_buffers(struct blkid_struct_probe *pr);
+
struct blkid_struct_probe *blkid_new_probe(void)
{
struct blkid_struct_probe *pr;
@@ -19,6 +22,8 @@ struct blkid_struct_probe *blkid_new_probe(void)
if (!pr)
return NULL;
+ INIT_LIST_HEAD(&pr->buffers);
+
return pr;
}
@@ -27,5 +32,23 @@ void blkid_free_probe(struct blkid_struct_probe *pr)
if (!pr)
return;
+ blkid_probe_reset_buffers(pr);
+
free(pr);
}
+
+static int blkid_probe_reset_buffers(struct blkid_struct_probe *pr)
+{
+ if (list_empty(&pr->buffers))
+ return 0;
+
+ while (!list_empty(&pr->buffers)) {
+ struct blkid_bufinfo *bf = list_first_entry(&pr->buffers, struct blkid_bufinfo, bufs);
+
+ list_del(&bf->bufs);
+
+ free(bf);
+ }
+
+ return 0;
+}