mirror of
https://github.com/subsurface/subsurface.git
synced 2024-11-28 05:00:20 +00:00
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>
This commit is contained in:
parent
65a988a232
commit
8d54c9640d
1 changed files with 2 additions and 0 deletions
2
dive.c
2
dive.c
|
@ -2749,6 +2749,8 @@ void set_save_userid_local(short value)
|
||||||
|
|
||||||
void set_userid(char *rUserId)
|
void set_userid(char *rUserId)
|
||||||
{
|
{
|
||||||
|
if (prefs.userid)
|
||||||
|
free(prefs.userid);
|
||||||
prefs.userid = strdup(rUserId);
|
prefs.userid = strdup(rUserId);
|
||||||
if (strlen(prefs.userid) > 30)
|
if (strlen(prefs.userid) > 30)
|
||||||
prefs.userid[30]='\0';
|
prefs.userid[30]='\0';
|
||||||
|
|
Loading…
Reference in a new issue