mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2025-12-29 16:10:11 +01:00
cli: use "free()" for string from readline
Since glib 2.45, we are guaranteed that g_free() just calls free(), so both can be used interchangeably. However, we still only depend on glib 2.40. In any case, it's ugly to mix the two. Memory allocated by plain malloc(), should be only freed with free(). The buffer in question comes from readline, which allocates it using the system allocator. Fixes:995229181c('cli: remove editor thread') (cherry picked from commit5dc07174d3) (cherry picked from commit633c734255)
This commit is contained in:
parent
e2c83c61f0
commit
5199bd51e2
1 changed files with 2 additions and 5 deletions
|
|
@ -926,7 +926,6 @@ read_again:
|
|||
if (nmc_config->in_editor || (rl_string && *rl_string)) {
|
||||
/* In editor, or the line is not empty */
|
||||
/* Call readline again to get new prompt (repeat) */
|
||||
g_free(rl_string);
|
||||
goto read_again;
|
||||
} else {
|
||||
/* Not in editor and line is empty, exit */
|
||||
|
|
@ -939,10 +938,8 @@ read_again:
|
|||
}
|
||||
|
||||
/* Return NULL, not empty string */
|
||||
if (rl_string && *rl_string == '\0') {
|
||||
g_free(rl_string);
|
||||
rl_string = NULL;
|
||||
}
|
||||
if (rl_string && *rl_string == '\0')
|
||||
nm_clear_free(&rl_string);
|
||||
|
||||
nm_clear_g_source_inst(&io_source);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue