mirror of
https://gitlab.com/chrony/chrony.git
synced 2025-12-03 17:35:06 -05:00
client: fix memory leak of empty readline() string
This commit is contained in:
3
client.c
3
client.c
@@ -125,12 +125,11 @@ read_line(void)
|
||||
strncpy(line, cmd, sizeof(line) - 1);
|
||||
line[sizeof(line) - 1] = '\0';
|
||||
add_history(cmd);
|
||||
/* free the buffer allocated by readline */
|
||||
Free(cmd);
|
||||
} else {
|
||||
/* simulate the user has entered an empty line */
|
||||
*line = '\0';
|
||||
}
|
||||
Free(cmd);
|
||||
return( line );
|
||||
#else
|
||||
printf("%s", prompt);
|
||||
|
||||
Reference in New Issue
Block a user