There are several resource leaks and pointer issues in the code which need to be fixed. Patch will follow.
Created attachment 13740 [details] patch for 4.7
Created attachment 13741 [details] patch for 4.6
Re-assigning to Karolin for
...inclusion in 4.7.next, 4.6.next.
(In reply to Jeremy Allison from comment #4) Pushed to autobuild-v4-{7,6}-test.
(In reply to Karolin Seeger from comment #5) Pushed to both branches. Closing out bug report. Thanks!