summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Stefan Fuchs <sfuchs@gmx.de>2018-01-22 20:29:55 +0100
committerGravatar Dirk Hohndel <dirk@hohndel.org>2018-02-02 11:29:55 -0800
commitb5ce06c8b958cdc51761c31697189db81baf4423 (patch)
treea4b6550674a4f189b847c76a50f287fbb31cd1b8
parentd6c8edc2dbf04592ecf2ba00c743038babfa6f6b (diff)
downloadsubsurface-b5ce06c8b958cdc51761c31697189db81baf4423.tar.gz
Free various struct membuffer in different functions
Signed-off-by: Stefan Fuchs <sfuchs@gmx.de>
-rw-r--r--core/linux.c1
-rw-r--r--core/save-git.c2
-rw-r--r--desktop-widgets/subsurfacewebservices.cpp2
-rw-r--r--profile-widget/diveeventitem.cpp1
4 files changed, 5 insertions, 1 deletions
diff --git a/core/linux.c b/core/linux.c
index 2ae4d5c7e..de7991bc7 100644
--- a/core/linux.c
+++ b/core/linux.c
@@ -42,6 +42,7 @@ void subsurface_user_info(struct user_info *user)
gethostname(hostname, sizeof(hostname));
put_format(&mb, "%s@%s", username, hostname);
user->email = mb_cstring(&mb);
+ free_buffer(&mb);
}
}
diff --git a/core/save-git.c b/core/save-git.c
index d09513e1d..a00aeed94 100644
--- a/core/save-git.c
+++ b/core/save-git.c
@@ -903,6 +903,7 @@ static void save_divesites(git_repository *repo, struct dir *tree)
struct membuffer dirname = { 0 };
put_format(&dirname, "01-Divesites");
subdir = new_directory(repo, tree, &dirname);
+ free_buffer(&dirname);
for (int i = 0; i < dive_site_table.nr; i++) {
struct membuffer b = { 0 };
@@ -946,6 +947,7 @@ static void save_divesites(git_repository *repo, struct dir *tree)
}
}
blob_insert(repo, subdir, &b, mb_cstring(&site_file_name));
+ free_buffer(&site_file_name);
}
}
diff --git a/desktop-widgets/subsurfacewebservices.cpp b/desktop-widgets/subsurfacewebservices.cpp
index 93398ae6c..2db35b88a 100644
--- a/desktop-widgets/subsurfacewebservices.cpp
+++ b/desktop-widgets/subsurfacewebservices.cpp
@@ -125,7 +125,7 @@ bool DivelogsDeWebServices::prepare_dives_for_divelogs(const QString &tempfile,
report_error(tr("internal error").toUtf8());
goto error_close_zip;
}
- free((void *)membuf);
+ free_buffer(&mb);
transformed = xsltApplyStylesheet(xslt, doc, NULL);
if (!transformed) {
diff --git a/profile-widget/diveeventitem.cpp b/profile-widget/diveeventitem.cpp
index f47c5839c..8c8db6fd4 100644
--- a/profile-widget/diveeventitem.cpp
+++ b/profile-widget/diveeventitem.cpp
@@ -184,6 +184,7 @@ void DiveEventItem::setupToolTipString(struct gasmix *lastgasmix)
tr("ΔN₂").toUtf8().constData(), icd_data.dN2 / 10.0,
icd ? ">" : "<", lrint(-icd_data.dHe / 5.0) / 10.0);
name += QString::fromUtf8(mb.buffer, mb.len);
+ free_buffer(&mb);
}
*lastgasmix = *mix;
} else if (value) {