summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorwl <wl>2007-09-11 07:14:16 +0000
committerwl <wl>2007-09-11 07:14:16 +0000
commit7920686350fc1acd363bd1bde5c0b1bae7849990 (patch)
tree3ce2691448e10bdaa29b982d95a79c757aff52b0 /src
parentc2f55dadba28207d765657af1e9cbc973a3c8f3d (diff)
downloadgroff-7920686350fc1acd363bd1bde5c0b1bae7849990.tar.gz
* src/libs/libgroff/string.cpp (string::remove_spaces): Fix memory
allocation. * src/preproc/tbl/table.cpp (table::allocate): Initialize `blockflag' array.
Diffstat (limited to 'src')
-rw-r--r--src/libs/libgroff/string.cpp2
-rw-r--r--src/preproc/tbl/table.cpp4
2 files changed, 5 insertions, 1 deletions
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;
}
}