From 9f13a15e77c853189686ee70aaf16cbed3ad8d08 Mon Sep 17 00:00:00 2001 From: Werner LEMBERG Date: Tue, 11 Sep 2007 07:14:17 +0000 Subject: [PATCH] * src/libs/libgroff/string.cpp (string::remove_spaces): Fix memory allocation. * src/preproc/tbl/table.cpp (table::allocate): Initialize `blockflag' array. --- ChangeLog | 8 ++++++++ src/libs/libgroff/string.cpp | 2 +- src/preproc/tbl/table.cpp | 4 ++++ 3 files changed, 13 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index bcef7fde..0e2d73bb 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2007-09-11 Werner LEMBERG + + * src/libs/libgroff/string.cpp (string::remove_spaces): Fix memory + allocation. + + * src/preproc/tbl/table.cpp (table::allocate): Initialize + `blockflag' array. + 2007-09-10 Keith Marshall * README.MinGW: Add warnings about use of MSYS-RXVT, and about diff --git a/src/libs/libgroff/string.cpp b/src/libs/libgroff/string.cpp index 9be873c8..5458e369 100644 --- a/src/libs/libgroff/string.cpp +++ b/src/libs/libgroff/string.cpp @@ -309,7 +309,7 @@ void string::remove_spaces() if (len - 1 != l) { if (l >= 0) { len = l + 1; - char *tmp = new char[len]; + char *tmp = new char[sz]; memcpy(tmp, p, len); a_delete ptr; ptr = tmp; diff --git a/src/preproc/tbl/table.cpp b/src/preproc/tbl/table.cpp index 6835d9c0..7953b198 100644 --- a/src/preproc/tbl/table.cpp +++ b/src/preproc/tbl/table.cpp @@ -1339,6 +1339,8 @@ void table::allocate(int r) entry = new PPtable_entry[allocated_rows]; vline = new char*[allocated_rows]; blockflag = new char[allocated_rows]; + for (int i = 0; i < allocated_rows; i++) + blockflag[i] = 0; } else { table_entry ***old_entry = entry; @@ -1356,6 +1358,8 @@ void table::allocate(int r) char *old_blockflag = blockflag; blockflag = new char[allocated_rows]; memcpy(blockflag, old_blockflag, sizeof(char)*old_allocated_rows); + for (int i = old_allocated_rows; i < allocated_rows; i++) + blockflag[i] = 0; a_delete old_blockflag; } } -- 2.11.4.GIT