From 200699706ea0ae45b9036a3082bff83f98329f93 Mon Sep 17 00:00:00 2001 From: "Lubomir I. Ivanov" Date: Tue, 11 Nov 2014 21:41:47 +0200 Subject: [PATCH] maintab.cpp: use copy_string() instead of strdup() The .location and .notes fields can end up being NULL, in which case copy_string() is safer. Signed-off-by: Lubomir I. Ivanov Signed-off-by: Dirk Hohndel --- qt-ui/maintab.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/qt-ui/maintab.cpp b/qt-ui/maintab.cpp index 2962efc6f..c20eddbe1 100644 --- a/qt-ui/maintab.cpp +++ b/qt-ui/maintab.cpp @@ -691,11 +691,11 @@ void MainTab::acceptChanges() } else if (MainWindow::instance() && MainWindow::instance()->dive_list()->selectedTrips().count() == 1) { /* now figure out if things have changed */ if (!same_string(displayedTrip.notes, currentTrip->notes)) { - currentTrip->notes = strdup(displayedTrip.notes); + currentTrip->notes = copy_string(displayedTrip.notes); mark_divelist_changed(true); } if (!same_string(displayedTrip.location, currentTrip->location)) { - currentTrip->location = strdup(displayedTrip.location); + currentTrip->location = copy_string(displayedTrip.location); mark_divelist_changed(true); } currentTrip = NULL;