fix a memory error
Merge pull request #899 from karlnapf/master

minor memory error in example