* lib/readline.c (readline): Free memory after getline failure.
Copyright-paperwork-exempt: true
+2023-05-30 Nick Bowler <nbowler@draconx.ca>
+
+ readline: fix memory leak in replacement readline.
+ * lib/readline.c (readline): Free memory after getline failure.
+ Copyright-paperwork-exempt: Yes
+
2023-05-24 Bruno Haible <bruno@clisp.org>
asyncsafe-spin, simple-atomic: Don't use -mcpu-v9 on NetBSD/sparc.
/* readline.c --- Simple implementation of readline.
- Copyright (C) 2005-2007, 2009-2022 Free Software Foundation, Inc.
+ Copyright (C) 2005-2007, 2009-2023 Free Software Foundation, Inc.
Written by Simon Josefsson
This program is free software: you can redistribute it and/or modify
#include "readline.h"
#include <stdio.h>
+#include <stdlib.h>
#include <string.h>
char *
}
if (getline (&out, &size, stdin) < 0)
- return NULL;
+ {
+ free (out);
+ return NULL;
+ }
while (*out && (out[strlen (out) - 1] == '\r'
|| out[strlen (out) - 1] == '\n'))