summaryrefslogtreecommitdiffstats
path: root/lib/libedit
diff options
context:
space:
mode:
authorstefanf <stefanf@FreeBSD.org>2005-08-07 08:35:39 +0000
committerstefanf <stefanf@FreeBSD.org>2005-08-07 08:35:39 +0000
commit7907f74429f7c0fd75c643f450bb1e813c444315 (patch)
treed825b4f4f7523e559e5839c88fab7eaae33f735e /lib/libedit
parent449d4474b42c2ce47f7067f0435eb71eda24bd52 (diff)
downloadFreeBSD-src-7907f74429f7c0fd75c643f450bb1e813c444315.zip
FreeBSD-src-7907f74429f7c0fd75c643f450bb1e813c444315.tar.gz
Revert the replacement of realloc() with reallocf() (el.h:1.2, map.c:1.5 and
tokenizer.c:1.3). Contrary to the commit log there were no memory leaks, but the change introduced a bug because the free'd pointer was not zeroed and calling the appropriate _end() function would call free() a second time.
Diffstat (limited to 'lib/libedit')
-rw-r--r--lib/libedit/el.h1
-rw-r--r--lib/libedit/map.c4
-rw-r--r--lib/libedit/tokenizer.c3
3 files changed, 3 insertions, 5 deletions
diff --git a/lib/libedit/el.h b/lib/libedit/el.h
index dc1d257..655b391 100644
--- a/lib/libedit/el.h
+++ b/lib/libedit/el.h
@@ -91,7 +91,6 @@ typedef struct el_state_t {
*/
#define el_malloc(a) malloc(a)
#define el_realloc(a,b) realloc(a, b)
-#define el_reallocf(a,b) reallocf(a, b)
#define el_free(a) free(a)
#include "tty.h"
diff --git a/lib/libedit/map.c b/lib/libedit/map.c
index 67c61cf..eae4da2 100644
--- a/lib/libedit/map.c
+++ b/lib/libedit/map.c
@@ -1395,10 +1395,10 @@ map_addfunc(EditLine *el, const char *name, const char *help, el_func_t func)
if (name == NULL || help == NULL || func == NULL)
return (-1);
- if ((p = el_reallocf(el->el_map.func, nf * sizeof(el_func_t))) == NULL)
+ if ((p = el_realloc(el->el_map.func, nf * sizeof(el_func_t))) == NULL)
return (-1);
el->el_map.func = (el_func_t *) p;
- if ((p = el_reallocf(el->el_map.help, nf * sizeof(el_bindings_t)))
+ if ((p = el_realloc(el->el_map.help, nf * sizeof(el_bindings_t)))
== NULL)
return (-1);
el->el_map.help = (el_bindings_t *) p;
diff --git a/lib/libedit/tokenizer.c b/lib/libedit/tokenizer.c
index 8c7ae8e..463a980 100644
--- a/lib/libedit/tokenizer.c
+++ b/lib/libedit/tokenizer.c
@@ -65,7 +65,6 @@ typedef enum {
#define tok_malloc(a) malloc(a)
#define tok_free(a) free(a)
#define tok_realloc(a, b) realloc(a, b)
-#define tok_reallocf(a, b) reallocf(a, b)
struct tokenizer {
@@ -386,7 +385,7 @@ tok_line(Tokenizer *tok, const char *line, int *argc, char ***argv)
if (tok->argc >= tok->amax - 4) {
char **p;
tok->amax += AINCR;
- p = (char **) tok_reallocf(tok->argv,
+ p = (char **) tok_realloc(tok->argv,
tok->amax * sizeof(char *));
if (p == NULL)
return (-1);
OpenPOWER on IntegriCloud