dmconfig: fix talloc usage if filter is set

Fixes the following issues in talloc usage:
  * current_path was never freed
  * path might be talloc_free'd even if it was not talloc'd
  * argument variable path is reused (bad style)

At least issue 2 causes talloc aborts and consecutive crashes.

Fix this by rewriting the talloc handling in the following way:
  * use a centralized exit out
  * always free current_path
  * don't reuse path and instead use current_path

While at it, fix the leak of v if rpc_db_list() fails.

Signed-off-by: Jonas Gorski <jogo@openwrt.org>
Merge pull request #2 from KanjiMonster/fix-filter-talloc-usage-OpenCPE

dmconfig: fix talloc usage if filter is set
dmconfig: fix leaf-list handling

Signed-off-by: Petar Koretic <petar.koretic@sartura.hr>
dmconfig: fix leafref resolving

Signed-off-by: Petar Koretic <petar.koretic@sartura.hr>