Plugged little linenoise memory leaks.
This commit is contained in:
parent
e10637c419
commit
94ea37d2bc
2 changed files with 9 additions and 5 deletions
1
main.c
1
main.c
|
@ -1181,7 +1181,6 @@ Laction:
|
||||||
default:
|
default:
|
||||||
BUG(ACTION_RETURNED_PHASE_CODE_BEYOND_END_OF_SWITCH); // LCOV_EXCL_LINE
|
BUG(ACTION_RETURNED_PHASE_CODE_BEYOND_END_OF_SWITCH); // LCOV_EXCL_LINE
|
||||||
}
|
}
|
||||||
linenoiseFree(input);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
13
misc.c
13
misc.c
|
@ -351,9 +351,10 @@ char* get_input()
|
||||||
|
|
||||||
if (input == NULL) // Got EOF; return with it.
|
if (input == NULL) // Got EOF; return with it.
|
||||||
return (input);
|
return (input);
|
||||||
else if (input[0] == '#') // Ignore comments.
|
else if (input[0] == '#') { // Ignore comments.
|
||||||
|
linenoiseFree(input);
|
||||||
continue;
|
continue;
|
||||||
else // We have a 'normal' line; leave the loop.
|
} else // We have a 'normal' line; leave the loop.
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -389,6 +390,8 @@ bool silent_yes()
|
||||||
char* firstword = (char*) xmalloc(strlen(reply) + 1);
|
char* firstword = (char*) xmalloc(strlen(reply) + 1);
|
||||||
sscanf(reply, "%s", firstword);
|
sscanf(reply, "%s", firstword);
|
||||||
|
|
||||||
|
linenoiseFree(reply);
|
||||||
|
|
||||||
for (int i = 0; i < (int)strlen(firstword); ++i)
|
for (int i = 0; i < (int)strlen(firstword); ++i)
|
||||||
firstword[i] = tolower(firstword[i]);
|
firstword[i] = tolower(firstword[i]);
|
||||||
|
|
||||||
|
@ -408,7 +411,6 @@ bool silent_yes()
|
||||||
} else
|
} else
|
||||||
rspeak(PLEASE_ANSWER);
|
rspeak(PLEASE_ANSWER);
|
||||||
}
|
}
|
||||||
linenoiseFree(reply);
|
|
||||||
return (outcome);
|
return (outcome);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -435,6 +437,8 @@ bool yes(const char* question, const char* yes_response, const char* no_response
|
||||||
char* firstword = (char*) xmalloc(strlen(reply) + 1);
|
char* firstword = (char*) xmalloc(strlen(reply) + 1);
|
||||||
sscanf(reply, "%s", firstword);
|
sscanf(reply, "%s", firstword);
|
||||||
|
|
||||||
|
linenoiseFree(reply);
|
||||||
|
|
||||||
for (int i = 0; i < (int)strlen(firstword); ++i)
|
for (int i = 0; i < (int)strlen(firstword); ++i)
|
||||||
firstword[i] = tolower(firstword[i]);
|
firstword[i] = tolower(firstword[i]);
|
||||||
|
|
||||||
|
@ -455,8 +459,9 @@ bool yes(const char* question, const char* yes_response, const char* no_response
|
||||||
break;
|
break;
|
||||||
} else
|
} else
|
||||||
rspeak(PLEASE_ANSWER);
|
rspeak(PLEASE_ANSWER);
|
||||||
|
|
||||||
}
|
}
|
||||||
linenoiseFree(reply);
|
|
||||||
return (outcome);
|
return (outcome);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue