From cc01b41660498968aaa2cb94376fdf0aa02623bd Mon Sep 17 00:00:00 2001 From: Chris Toshok Date: Wed, 4 Feb 2004 18:42:17 +0000 Subject: [ fixes bug #53130 ] 2004-02-04 Chris Toshok [ fixes bug #53130 ] * libedata-book/e-data-book-view.c (MAKE_REALLOC): this might end up being a bad assumption, but since it's only used for string sequences, assume it always will be. We need to make a deep copy of the sequence. a memcpy isn't enough, as freeing the buffer causes the child strings to be freed. --- addressbook/ChangeLog | 10 ++++++++++ addressbook/libedata-book/e-data-book-view.c | 5 +++-- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/addressbook/ChangeLog b/addressbook/ChangeLog index 06c1890f4..01c8fef3a 100644 --- a/addressbook/ChangeLog +++ b/addressbook/ChangeLog @@ -1,3 +1,13 @@ +2004-02-04 Chris Toshok + + [ fixes bug #53130 ] + + * libedata-book/e-data-book-view.c (MAKE_REALLOC): this might end + up being a bad assumption, but since it's only used for string + sequences, assume it always will be. We need to make a deep copy + of the sequence. a memcpy isn't enough, as freeing the buffer + causes the child strings to be freed. + 2004-02-04 Chris Toshok * libebook/e-book.c (e_book_op_free): remove the misleading "XXX diff --git a/addressbook/libedata-book/e-data-book-view.c b/addressbook/libedata-book/e-data-book-view.c index 8db46ee72..8ff3c70a0 100644 --- a/addressbook/libedata-book/e-data-book-view.c +++ b/addressbook/libedata-book/e-data-book-view.c @@ -129,9 +129,10 @@ CORBA_sequence_ ## type ## _realloc (CORBA_sequence_ ## type *seq, \ CORBA_unsigned_long new_max) \ { \ type *new_buf; \ - \ + int i; \ new_buf = CORBA_sequence_ ## type ## _allocbuf (new_max); \ - memcpy (new_buf, seq->_buffer, seq->_maximum * sizeof (type)); \ + for (i = 0; i < seq->_maximum; i ++) \ + new_buf[i] = CORBA_string_dup (seq->_buffer[i]); \ CORBA_free (seq->_buffer); \ seq->_buffer = new_buf; \ seq->_maximum = new_max; \ -- cgit v1.2.1