aboutsummaryrefslogtreecommitdiffstats
path: root/core/uploadDiveShare.cpp
diff options
context:
space:
mode:
authorGravatar Berthold Stoeger <bstoeger@mail.tuwien.ac.at>2021-07-20 07:45:31 +0200
committerGravatar Dirk Hohndel <dirk@hohndel.org>2021-07-23 11:22:43 -0700
commit16b31985c3245d5cb3be26f3cc0aa06bc6acb139 (patch)
tree972684866d5ec71781fbf91f990bea83a654ecad /core/uploadDiveShare.cpp
parentf142e9a9c6ba493c09a282544da8715b3656648e (diff)
downloadsubsurface-16b31985c3245d5cb3be26f3cc0aa06bc6acb139.tar.gz
cleanup: replace membuffer by membufferpp in C-code
Thus, the membuffer data is automatically freed when going out of scope - one thing less to worry about. This fixes one use-after-free bug in uploadDiveLogsDE.cpp and one extremely questionable practice in divetooltipitem.cpp: The membuffer was a shared instance across all instances of the DiveToolTipItem. Remves unnecessary #include directives in files that didn't even use membuffer. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Diffstat (limited to 'core/uploadDiveShare.cpp')
-rw-r--r--core/uploadDiveShare.cpp3
1 files changed, 1 insertions, 2 deletions
diff --git a/core/uploadDiveShare.cpp b/core/uploadDiveShare.cpp
index 8d5858e00..87c3d0b24 100644
--- a/core/uploadDiveShare.cpp
+++ b/core/uploadDiveShare.cpp
@@ -27,10 +27,9 @@ uploadDiveShare::uploadDiveShare():
void uploadDiveShare::doUpload(bool selected, const QString &uid, bool noPublic)
{
//generate json
- struct membuffer buf = {};
+ struct membufferpp buf;
export_list(&buf, NULL, selected, false);
QByteArray json_data(buf.buffer, buf.len);
- free_buffer(&buf);
//Request to server
QNetworkRequest request;