Fix initialization (under Valgrind) in SparseArray::resize().

If SparseArray::resize() is called when sparse_to_dense_ is NULL (which
happens if it was initialized with the default constructor, then
resized) the Valgrind-only initialization code is not run and Valgrind
will complain about uninitialized memory accesses within the newly
allocated array.

This patch moves the init code out of the if (sparse_to_dense_) block
which is safe because in this NULL case max_size_ will be 0 and this
will be equivalent to the init code in the non-default constructor.

Change-Id: Ic0b86ddb692a525630370118c08e8e8feb812cca
Reviewed-on: https://code-review.googlesource.com/3870
Reviewed-by: Paul Wankadia <junyer@google.com>
1 file changed