summaryrefslogtreecommitdiff
path: root/lib/libkeynote/keynote.l
diff options
context:
space:
mode:
Diffstat (limited to 'lib/libkeynote/keynote.l')
-rw-r--r--lib/libkeynote/keynote.l11
1 files changed, 4 insertions, 7 deletions
diff --git a/lib/libkeynote/keynote.l b/lib/libkeynote/keynote.l
index b3f0ffd4f16..02d10b039f5 100644
--- a/lib/libkeynote/keynote.l
+++ b/lib/libkeynote/keynote.l
@@ -1,5 +1,5 @@
%{
-/* $OpenBSD: keynote.l,v 1.20 2013/11/29 19:00:51 deraadt Exp $ */
+/* $OpenBSD: keynote.l,v 1.21 2015/02/04 20:35:51 bluhm Exp $ */
/*
* The author of this code is Angelos D. Keromytis (angelos@dsl.cis.upenn.edu)
*
@@ -269,9 +269,9 @@ keynote_lex_add(void *s, int type)
/* Not enough space, increase the size of the array */
keynote_max_lex_list *= 2;
- p = (struct lex_list *) realloc(keynote_lex_list,
- keynote_max_lex_list *
- sizeof(struct lex_list));
+ p = (struct lex_list *) reallocarray(keynote_lex_list,
+ keynote_max_lex_list,
+ sizeof(struct lex_list));
if (p == (struct lex_list *) NULL)
{
switch (type)
@@ -286,9 +286,6 @@ keynote_lex_add(void *s, int type)
return -1;
}
- if (p != keynote_lex_list)
- free(keynote_lex_list);
-
keynote_lex_list = p;
keynote_lex_list[i].lex_s = s;
keynote_lex_list[i++].lex_type = type;