summaryrefslogtreecommitdiffstats
path: root/dive.c
diff options
context:
space:
mode:
authorGravatar Anton Lundin <glance@acc.umu.se>2014-12-18 10:47:00 -0800
committerGravatar Dirk Hohndel <dirk@hohndel.org>2014-12-18 08:34:00 -0800
commit8d54c9640d028bfc51b02ff8cffe14b36bc5f51a (patch)
tree68ced2818c8d382edf5e29cff8a48fec7f3a0611 /dive.c
parent65a988a232da68f0cdeaf34fe7aebba16bc0c76b (diff)
downloadsubsurface-8d54c9640d028bfc51b02ff8cffe14b36bc5f51a.tar.gz
Free any previous userid before setting new
When we load multiple files, we call set_userid multiple times. Then we need to free the old user id before we set a new. Signed-off-by: Anton Lundin <glance@acc.umu.se> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'dive.c')
-rw-r--r--dive.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/dive.c b/dive.c
index c3f562bac..734639312 100644
--- a/dive.c
+++ b/dive.c
@@ -2749,6 +2749,8 @@ void set_save_userid_local(short value)
void set_userid(char *rUserId)
{
+ if (prefs.userid)
+ free(prefs.userid);
prefs.userid = strdup(rUserId);
if (strlen(prefs.userid) > 30)
prefs.userid[30]='\0';