aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlan Coopersmith <alan.coopersmith@oracle.com>2013-08-10 12:30:39 -0700
committerUlrich Sibiller <uli42@gmx.de>2016-10-19 21:40:28 +0200
commit7156a20bc9c211becd299a264cce5db350147362 (patch)
treeab56b372895c531d817c3b1de4365fe78e471d8f
parent0574a55ebd9243cd8d0a5d0ee6161c598f99aef4 (diff)
downloadnx-libs-7156a20bc9c211becd299a264cce5db350147362.tar.gz
nx-libs-7156a20bc9c211becd299a264cce5db350147362.tar.bz2
nx-libs-7156a20bc9c211becd299a264cce5db350147362.zip
lcDB.c: ensure buffer size is updated correctly if realloc fails
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com> Backported-to-NX-by: Ulrich Sibiller <uli42@gmx.de>
-rw-r--r--nx-X11/lib/X11/lcDB.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/nx-X11/lib/X11/lcDB.c b/nx-X11/lib/X11/lcDB.c
index 027d7747b..cb509d273 100644
--- a/nx-X11/lib/X11/lcDB.c
+++ b/nx-X11/lib/X11/lcDB.c
@@ -210,11 +210,12 @@ realloc_parse_info(
int len)
{
char *p;
+ int newsize = BUFSIZE * ((parse_info.bufsize + len)/BUFSIZE + 1);
- parse_info.bufMaxSize = BUFSIZE * ((parse_info.bufsize + len)/BUFSIZE + 1);
- p = (char *)Xrealloc(parse_info.buf, parse_info.bufMaxSize);
+ p = Xrealloc(parse_info.buf, newsize);
if (p == NULL)
return False;
+ parse_info.bufMaxSize = newsize;
parse_info.buf = p;
return True;