Fixed a memory leek in sample storage (return values were getting copied twice and only freed once).