This is an automated email from the git hooks/post-receive script. rene pushed a commit to branch master in repository mdds.
commit 449dcf49a92a2902414fcbb459705c788081f1bb Author: Rene Engelhard <[email protected]> Date: Thu Apr 21 14:50:54 2016 +0200 Imported Upstream version 0.11.2 --- Makefile.in | 12 ++++++------ NEWS | 7 +++++++ configure | 32 ++++++++++++++++---------------- configure.ac | 2 +- include/mdds/multi_type_vector_def.inl | 9 +++++++++ include/mdds/multi_type_vector_types.hpp | 1 + src/multi_type_vector_test_custom.cpp | 30 ++++++++++++++++++++++++++++++ 7 files changed, 70 insertions(+), 23 deletions(-) diff --git a/Makefile.in b/Makefile.in index 828df63..4f732da 100644 --- a/Makefile.in +++ b/Makefile.in @@ -241,12 +241,12 @@ install: $(HEADERS) install -d $(DESTDIR)@docdir@ install -d $(DESTDIR)@datarootdir@ install -d $(DESTDIR)@datarootdir@/pkgconfig - install -m 644 -t $(DESTDIR)@includedir@/mdds @top_srcdir@/$(INCDIR)/mdds/*.hpp - install -m 644 -t $(DESTDIR)@includedir@/mdds @top_srcdir@/$(INCDIR)/mdds/*.inl - install -m 644 -t $(DESTDIR)@includedir@/mdds/compat @top_srcdir@/$(INCDIR)/mdds/compat/*.hpp - install -m 644 -t $(DESTDIR)@includedir@/mdds/hash_container @top_srcdir@/$(INCDIR)/mdds/hash_container/*.hpp - install -m 644 -t $(DESTDIR)@datarootdir@/pkgconfig $(MISCDIR)/mdds.pc - install -m 644 -t $(DESTDIR)@docdir@ @top_srcdir@/AUTHORS @top_srcdir@/COPYING @top_srcdir@/NEWS @top_srcdir@/README @top_srcdir@/VERSION + install -m 644 @top_srcdir@/$(INCDIR)/mdds/*.hpp $(DESTDIR)@includedir@/mdds + install -m 644 @top_srcdir@/$(INCDIR)/mdds/*.inl $(DESTDIR)@includedir@/mdds + install -m 644 @top_srcdir@/$(INCDIR)/mdds/compat/*.hpp $(DESTDIR)@includedir@/mdds/compat + install -m 644 @top_srcdir@/$(INCDIR)/mdds/hash_container/*.hpp $(DESTDIR)@includedir@/mdds/hash_container + install -m 644 $(MISCDIR)/mdds.pc $(DESTDIR)@datarootdir@/pkgconfig + install -m 644 @top_srcdir@/AUTHORS @top_srcdir@/COPYING @top_srcdir@/NEWS @top_srcdir@/README @top_srcdir@/VERSION $(DESTDIR)@docdir@ check: $(ALL_TESTS) diff --git a/NEWS b/NEWS index b00d0d0..94b4206 100644 --- a/NEWS +++ b/NEWS @@ -1,3 +1,10 @@ +mdds 0.11.2 + +* multi_type_vector + + * fixed various memory leaks associated with the set() method when a + value overwrites an existing element in a managed block. + mdds 0.11.1 * all diff --git a/configure b/configure index caa8c78..2424caa 100755 --- a/configure +++ b/configure @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.69 for mdds 0.11.1. +# Generated by GNU Autoconf 2.69 for mdds 0.11.2. # # Report bugs to <[email protected]>. # @@ -579,8 +579,8 @@ MAKEFLAGS= # Identity of this package. PACKAGE_NAME='mdds' PACKAGE_TARNAME='mdds' -PACKAGE_VERSION='0.11.1' -PACKAGE_STRING='mdds 0.11.1' +PACKAGE_VERSION='0.11.2' +PACKAGE_STRING='mdds 0.11.2' PACKAGE_BUGREPORT='[email protected]' PACKAGE_URL='' @@ -1181,7 +1181,7 @@ if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures mdds 0.11.1 to adapt to many kinds of systems. +\`configure' configures mdds 0.11.2 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1242,7 +1242,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of mdds 0.11.1:";; + short | recursive ) echo "Configuration of mdds 0.11.2:";; esac cat <<\_ACEOF @@ -1335,7 +1335,7 @@ fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -mdds configure 0.11.1 +mdds configure 0.11.2 generated by GNU Autoconf 2.69 Copyright (C) 2012 Free Software Foundation, Inc. @@ -1352,7 +1352,7 @@ cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by mdds $as_me 0.11.1, which was +It was created by mdds $as_me 0.11.2, which was generated by GNU Autoconf 2.69. Invocation command line was $ $0 $@ @@ -1701,7 +1701,7 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu -VERSION=0.11.1 +VERSION=0.11.2 PACKAGE_TARNAME=mdds @@ -2298,7 +2298,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by mdds $as_me 0.11.1, which was +This file was extended by mdds $as_me 0.11.2, which was generated by GNU Autoconf 2.69. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -2351,7 +2351,7 @@ _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ -mdds config.status 0.11.1 +mdds config.status 0.11.2 configured by $0, generated by GNU Autoconf 2.69, with options \\"\$ac_cs_config\\" @@ -3455,7 +3455,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by mdds $as_me 0.11.1, which was +This file was extended by mdds $as_me 0.11.2, which was generated by GNU Autoconf 2.69. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -3508,7 +3508,7 @@ _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ -mdds config.status 0.11.1 +mdds config.status 0.11.2 configured by $0, generated by GNU Autoconf 2.69, with options \\"\$ac_cs_config\\" @@ -4613,7 +4613,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by mdds $as_me 0.11.1, which was +This file was extended by mdds $as_me 0.11.2, which was generated by GNU Autoconf 2.69. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -4666,7 +4666,7 @@ _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ -mdds config.status 0.11.1 +mdds config.status 0.11.2 configured by $0, generated by GNU Autoconf 2.69, with options \\"\$ac_cs_config\\" @@ -5772,7 +5772,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by mdds $as_me 0.11.1, which was +This file was extended by mdds $as_me 0.11.2, which was generated by GNU Autoconf 2.69. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -5825,7 +5825,7 @@ _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ -mdds config.status 0.11.1 +mdds config.status 0.11.2 configured by $0, generated by GNU Autoconf 2.69, with options \\"\$ac_cs_config\\" diff --git a/configure.ac b/configure.ac index c56e41e..7b032b6 100644 --- a/configure.ac +++ b/configure.ac @@ -1,4 +1,4 @@ -AC_INIT(mdds, 0.11.1, [email protected]) +AC_INIT(mdds, 0.11.2, [email protected]) VERSION=AC_PACKAGE_VERSION AC_SUBST(VERSION) diff --git a/include/mdds/multi_type_vector_def.inl b/include/mdds/multi_type_vector_def.inl index f1f4104..b6345b6 100644 --- a/include/mdds/multi_type_vector_def.inl +++ b/include/mdds/multi_type_vector_def.inl @@ -364,6 +364,7 @@ multi_type_vector<_CellBlockFunc>::set_impl( // Append to the previous block. size_type offset = blk_prev->m_size; blk->m_size -= 1; + element_block_func::overwrite_values(*blk->mp_data, 0, 1); element_block_func::erase(*blk->mp_data, 0); blk_prev->m_size += 1; mdds_mtv_append_value(*blk_prev->mp_data, value); @@ -411,6 +412,7 @@ multi_type_vector<_CellBlockFunc>::set_impl( // Pop the last cell off the current block, and prepend the // new cell to the next block. + element_block_func::overwrite_values(*blk->mp_data, blk->m_size-1, 1); element_block_func::erase(*blk->mp_data, blk->m_size-1); blk->m_size -= 1; mdds_mtv_prepend_value(*blk_next->mp_data, value); @@ -440,6 +442,7 @@ multi_type_vector<_CellBlockFunc>::set_impl( // Pop the last element from the current block, and prepend the cell // into the next block. + element_block_func::overwrite_values(*blk->mp_data, blk->m_size-1, 1); element_block_func::erase(*blk->mp_data, blk->m_size-1); blk->m_size -= 1; mdds_mtv_prepend_value(*blk_next->mp_data, value); @@ -1170,7 +1173,10 @@ void multi_type_vector<_CellBlockFunc>::set_cell_to_top_of_data_block(size_type block* blk = m_blocks[block_index]; blk->m_size -= 1; if (blk->mp_data) + { + element_block_func::overwrite_values(*blk->mp_data, 0, 1); element_block_func::erase(*blk->mp_data, 0); + } m_blocks.insert(m_blocks.begin()+block_index, new block(1)); blk = m_blocks[block_index]; create_new_block_with_new_cell(blk->mp_data, cell); @@ -1183,7 +1189,10 @@ void multi_type_vector<_CellBlockFunc>::set_cell_to_bottom_of_data_block(size_ty assert(block_index < m_blocks.size()); block* blk = m_blocks[block_index]; if (blk->mp_data) + { + element_block_func::overwrite_values(*blk->mp_data, blk->m_size-1, 1); element_block_func::erase(*blk->mp_data, blk->m_size-1); + } blk->m_size -= 1; m_blocks.insert(m_blocks.begin()+block_index+1, new block(1)); blk = m_blocks[block_index+1]; diff --git a/include/mdds/multi_type_vector_types.hpp b/include/mdds/multi_type_vector_types.hpp index bb8fdbe..db8d584 100644 --- a/include/mdds/multi_type_vector_types.hpp +++ b/include/mdds/multi_type_vector_types.hpp @@ -40,6 +40,7 @@ #include <boost/noncopyable.hpp> #if defined(MDDS_UNIT_TEST) || defined (MDDS_MULTI_TYPE_VECTOR_DEBUG) +#include <algorithm> #include <iostream> #include <sstream> using std::cout; diff --git a/src/multi_type_vector_test_custom.cpp b/src/multi_type_vector_test_custom.cpp index 2ceaad5..4add596 100644 --- a/src/multi_type_vector_test_custom.cpp +++ b/src/multi_type_vector_test_custom.cpp @@ -961,6 +961,36 @@ void mtv_test_managed_block() delete p1; delete p2; } + + { + mtv_type db(5); + + db.set(1, new muser_cell(1.1)); + db.set(2, new muser_cell(1.2)); + db.set(3, new muser_cell(1.3)); + + db.set(1, 2.1); // Don't leak the overwritten muser_cell instance. + db.set(2, 2.2); // ditto + } + + { + mtv_type db(4); + db.set(0, new muser_cell(1.1)); + db.set(1, new muser_cell(1.2)); + db.set(2, new muser_cell(1.3)); + + db.set(2, 2.1); // Don't leak the overwritten muser_cell instance. + db.set(1, 2.0); // ditto + } + + { + mtv_type db(8); + db.set(3, new muser_cell(1.1)); + db.set(4, new muser_cell(1.2)); + db.set(5, 1.3); + + db.set(4, 2.2); // Overwrite muser_cell and don't leak. + } } void mtv_test_custom_block_func1() -- Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-openoffice/mdds.git

