summaryrefslogtreecommitdiffstats
path: root/gtk-gui.c
diff options
context:
space:
mode:
authorGravatar Dirk Hohndel <dirk@hohndel.org>2012-12-27 21:38:23 -0800
committerGravatar Dirk Hohndel <dirk@hohndel.org>2012-12-27 21:41:12 -0800
commitf6fb8823378a692acec09926b5ab42b0561b17f2 (patch)
tree696a60dc415dadc3766bad2ef0c6702c44d66225 /gtk-gui.c
parentfd03fcd66dae7e1e909a29639f01b4b5368f3877 (diff)
downloadsubsurface-f6fb8823378a692acec09926b5ab42b0561b17f2.tar.gz
Fix incorrect memory access in nickname handling
There was one code path where we didn't strdup the nickname - and this got triggered when parsing XML files with divecomputerid entries for dive computers that were already in the config. The nickname is then replaced with the nickname from the parser - and that memory is later reused... We should cleanup that nickname, anyway, and that also takes care of making sure we have our own copy. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'gtk-gui.c')
-rw-r--r--gtk-gui.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/gtk-gui.c b/gtk-gui.c
index c5b31348b..35bfd5116 100644
--- a/gtk-gui.c
+++ b/gtk-gui.c
@@ -2188,7 +2188,7 @@ void remember_dc(const char *model, uint32_t deviceid, const char *nickname, gbo
struct dcnicknamelist *nn_entry = get_dc_nicknameentry(model, deviceid);
if (!nn_entry->model || !*nn_entry->model)
nn_entry->model = model;
- nn_entry->nickname = nickname;
+ nn_entry->nickname = cleanedup_nickname(nickname, 80);
replace_nickname_nicknamestring(model, deviceid, nickname);
}
#if defined(NICKNAME_DEBUG)