mirror of
https://github.com/troglobit/editline.git
synced 2025-05-06 12:31:45 +08:00
Fix memory leak in completion handler.
Coverty CID #56739 Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
This commit is contained in:
parent
7cd7fc4b61
commit
cd50714e29
@ -1369,8 +1369,10 @@ static el_status_t c_complete(void)
|
|||||||
len = strlen(p);
|
len = strlen(p);
|
||||||
word = p;
|
word = p;
|
||||||
new = q = malloc(sizeof(char) * (2 * len + 1));
|
new = q = malloc(sizeof(char) * (2 * len + 1));
|
||||||
if (!new)
|
if (!new) {
|
||||||
|
free(word);
|
||||||
return CSstay;
|
return CSstay;
|
||||||
|
}
|
||||||
while (*p) {
|
while (*p) {
|
||||||
if ((*p < ' ' || strchr(SEPS, *p) != NULL)
|
if ((*p < ' ' || strchr(SEPS, *p) != NULL)
|
||||||
&& (!unique || p[1] != 0)) {
|
&& (!unique || p[1] != 0)) {
|
||||||
|
Loading…
Reference in New Issue
Block a user