fix memory leaks caused with SmNodeStack

SmNodeStack now frees its own pointers after use.

Change-Id: Ie43eb887810a3424109708c956ccbdf97fc5a2e5
Reviewed-on: https://gerrit.libreoffice.org/12970
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>