fix memory leak reported in https://dev.openwrt.org/ticket/4236