uci: fix memory leak in rpc_uci_replace_savedir() master
authorJo-Philipp Wich <jo@mein.io>
Sun, 13 May 2018 19:13:05 +0000 (21:13 +0200)
committerJo-Philipp Wich <jo@mein.io>
Sun, 13 May 2018 19:13:05 +0000 (21:13 +0200)
commit820621952d537c49deba470c6f61c40df93f4ba8
tree884c6f3f782202600e1d0adb0e2b1ffc722bf2f3
parent10f787881da2dc6aac261a2ee3b5eedc0f8b5b54
uci: fix memory leak in rpc_uci_replace_savedir()

The rpc_uci_replace_savedir() function did not take into account that libuci
uci_set_savedir() does an additional implicit uci_strdup() of the directory
path string when appending a new delta directory item.

Due to this oversight, only the struct uci_element items got freed, but not
the duplicated path string, leading to leaking memory when invoking the uci
api with session id argument.

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
uci.c