NNZ: added unit test and fixed get_next_feature()

Added a test for the nnz iterator and fixed an issue with get_next_feature() that caused a memory leak or even a seg fault if used in a while loop (like it is used now) and not in a for loop ( for get_nnz_features_for_vector() times that is ).