[netcf-devel] [PATCH] Fix memory leaks in interactive mode of ncftool

Laine Stump laine at laine.org
Fri Jun 13 10:31:53 UTC 2014


On 06/05/2014 09:09 AM, Jianwei Hu wrote:
> Signed-off-by: Jianwei Hu <jiahu at redhat.com>
> ---
>  src/ncftool.c | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/src/ncftool.c b/src/ncftool.c
> index 90c6cbf..7a1db5b 100644
> --- a/src/ncftool.c
> +++ b/src/ncftool.c
> @@ -830,10 +830,13 @@ static int main_loop(void) {
>          }
>  
>          cmdret = run_command_line(line, &cmdstatus);
> -        if (cmdret == 0 && cmdstatus == CMD_RES_QUIT)
> +        if (cmdret == 0 && cmdstatus == CMD_RES_QUIT) {
> +            free(line);
>              return ret;
> +        }
>  
>          add_history(line);
> +        free(line);
>          ret = cmdret;
>      }
>  }

ACK and pushed. Thanks for the contribution!



More information about the netcf-devel mailing list