From f6fb8823378a692acec09926b5ab42b0561b17f2 Mon Sep 17 00:00:00 2001 From: Dirk Hohndel Date: Thu, 27 Dec 2012 21:38:23 -0800 Subject: 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 --- gtk-gui.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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) -- cgit v1.2.3-70-g09d2