Fix memory leak caused by node clipboard

The issue was caused by combination of following factors:

- Clipboard cleanup function will pass node tree as NULL to node free
  function.

  This is fine on it's own, we don't have tree in clipboard.

- Node free function will call node storage cleanup only when there is
  a non-NULL node tree.

  This is somewhat weird, because storage cleanup does not take node
  tree as argument.

So the solution here: move node storage cleanup outside of check that
node tree is not NULL.
This commit is contained in:
Sergey Sharybin 2017-07-11 11:06:36 +02:00
parent 1dfc4be6ab
commit d5d7d453a5

@ -1700,11 +1700,12 @@ static void node_free_node_ex(bNodeTree *ntree, bNode *node, bool remove_animdat
ntreeTexEndExecTree(ntree->execdata);
ntree->execdata = NULL;
}
if (node->typeinfo->freefunc)
node->typeinfo->freefunc(node);
}
if (node->typeinfo->freefunc) {
node->typeinfo->freefunc(node);
}
for (sock = node->inputs.first; sock; sock = nextsock) {
nextsock = sock->next;
node_socket_free(ntree, sock, node);