If the test failed too early, we dereferenced tree2 which
was still NULL.
Signed-off-by: Michael Adam <obnox@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
status = smb2_create(tree, mem_ctx, &io);
CHECK_STATUS(status, NT_STATUS_USER_SESSION_DELETED);
+ TALLOC_FREE(tree);
+
/*
* but a durable reconnect on the new session succeeds:
*/
h = &_h;
done:
- if (h != NULL) {
- smb2_util_close(tree, *h);
+ if (tree == NULL) {
+ tree = tree2;
}
- smb2_util_unlink(tree, fname);
+ if (tree != NULL) {
+ if (h != NULL) {
+ smb2_util_close(tree, *h);
+ }
- talloc_free(tree);
+ smb2_util_unlink(tree, fname);
+
+ talloc_free(tree);
+ }
talloc_free(mem_ctx);