mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
Free some nickname related memory in gtk-gui.c
init_ui(): We add the char pointer "conf_copy" and free it afterwards, since once "next_token" is changed it no longer points to the allocated heap location the mapper returned. [Dirk Hohndel: original patch rewritten to have better variable names and to match the recent changes to this code] Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
b10ebbda61
commit
ba223798d3
1 changed files with 3 additions and 3 deletions
|
@ -1205,10 +1205,10 @@ void init_ui(int *argcp, char ***argvp)
|
||||||
conf_value = subsurface_get_conf("dc_nicknames", PREF_STRING);
|
conf_value = subsurface_get_conf("dc_nicknames", PREF_STRING);
|
||||||
nicknamestring = strdup("");
|
nicknamestring = strdup("");
|
||||||
if (conf_value) {
|
if (conf_value) {
|
||||||
char *next_token, *nickname, *model;
|
char *next_token, *nickname, *model, *conf_copy;
|
||||||
uint32_t deviceid;
|
uint32_t deviceid;
|
||||||
int len;
|
int len;
|
||||||
next_token = strdup(conf_value);
|
next_token = conf_copy = strdup(conf_value);
|
||||||
len = strlen(next_token);
|
len = strlen(next_token);
|
||||||
while ((next_token = g_utf8_strchr(next_token, len, '{')) != NULL) {
|
while ((next_token = g_utf8_strchr(next_token, len, '{')) != NULL) {
|
||||||
/* replace the '{' so we keep looking in case any test fails */
|
/* replace the '{' so we keep looking in case any test fails */
|
||||||
|
@ -1246,7 +1246,7 @@ void init_ui(int *argcp, char ***argvp)
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
free((void *)conf_value);
|
free((void *)conf_value);
|
||||||
free(next_token);
|
free(conf_copy);
|
||||||
}
|
}
|
||||||
error_info_bar = NULL;
|
error_info_bar = NULL;
|
||||||
win = gtk_window_new(GTK_WINDOW_TOPLEVEL);
|
win = gtk_window_new(GTK_WINDOW_TOPLEVEL);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue