summaryrefslogtreecommitdiffstats
path: root/src/proc_self_mountinfo.c
diff options
context:
space:
mode:
authorFederico Ceratto <federico.ceratto@gmail.com>2018-03-27 21:28:21 +0000
committerFederico Ceratto <federico.ceratto@gmail.com>2018-03-27 21:28:21 +0000
commitd4dd00f58a502c9ca4b63e36ce6bc7a9945dc63c (patch)
treefaac99f51f182bb8c0a03e95e393d421ac9ddf42 /src/proc_self_mountinfo.c
parentNew upstream version 1.9.0+dfsg (diff)
downloadnetdata-d4dd00f58a502c9ca4b63e36ce6bc7a9945dc63c.tar.xz
netdata-d4dd00f58a502c9ca4b63e36ce6bc7a9945dc63c.zip
New upstream version 1.10.0+dfsgupstream/1.10.0+dfsg
Diffstat (limited to 'src/proc_self_mountinfo.c')
-rw-r--r--src/proc_self_mountinfo.c21
1 files changed, 11 insertions, 10 deletions
diff --git a/src/proc_self_mountinfo.c b/src/proc_self_mountinfo.c
index bb031a9ab..4ccdddff1 100644
--- a/src/proc_self_mountinfo.c
+++ b/src/proc_self_mountinfo.c
@@ -103,20 +103,11 @@ struct mountinfo *mountinfo_find_by_filesystem_super_option(struct mountinfo *ro
return NULL;
}
-
-// free a linked list of mountinfo structures
-void mountinfo_free(struct mountinfo *mi) {
- if(unlikely(!mi))
- return;
-
- if(likely(mi->next))
- mountinfo_free(mi->next);
-
+static void mountinfo_free(struct mountinfo *mi) {
freez(mi->root);
freez(mi->mount_point);
freez(mi->mount_options);
freez(mi->persistent_id);
-
/*
if(mi->optional_fields_count) {
int i;
@@ -131,6 +122,16 @@ void mountinfo_free(struct mountinfo *mi) {
freez(mi);
}
+// free a linked list of mountinfo structures
+void mountinfo_free_all(struct mountinfo *mi) {
+ while(mi) {
+ struct mountinfo *t = mi;
+ mi = mi->next;
+
+ mountinfo_free(t);
+ }
+}
+
static char *strdupz_decoding_octal(const char *string) {
char *buffer = strdupz(string);