sl: Fix leak

This commit is contained in:
Nicolas Williams
2022-12-31 00:50:10 -06:00
parent b93129f83d
commit 0ffb00275a

View File

@@ -321,8 +321,10 @@ sl_command_loop(SL_cmd *cmds, const char *prompt, void **data)
size_t len;
buf2 = sl_readline(buf == NULL ? prompt : "> ");
if (buf2 == NULL)
if (buf2 == NULL) {
free(buf);
return -2;
}
if (buf) {
char *tmp = NULL;