teamd: fix a json object memleak in get_port_obj()
teamd: fix a json object memleak in get_port_obj()

The issue can be noticed simply by doing:

  # ip link add aeth0 type dummy
  # teamd -d -t ateam0 -c '{"link_watch" : {"name" : "ethtool"}}'
  # teamdctl ateam0 port add aeth0

  # while true; do
  #     teamdctl ateam0 config dump actual > /dev/null
  #     date "+%Y-%m-%dT%H:%M:%S $(ps -auwwx | grep teamd |grep -v grep)"
  # done

After 30 mins:
                      USER       PID %CPU %MEM    VSZ  ... COMMAND
  2019-06-06T06:25:55 root     26574  0.0  0.0  66572  ... teamd ...
  ...
  2019-06-06T06:55:55 root     26574  1.2  0.6  89012  ... teamd ...

MEM used by team grew from 0.0% to 0.6%, VSZ from 66572 to 89012.

get_port_obj() calld in teamd_config_actual_dump() should not have used
json_object_set(), which can json_incref the child object causing later
json_decref(parent object) not to be able to free it.

So change to use json_object_set_new(), a function for setting newly
created objects, and it won't json_incref the child object that will
be freed when its parent object gets freed later.

Fixes: c6eba4866e18 ("teamd: add possibility to add/change port config")
Reported-by: Michael Colombo <9b72361a0b12d0b4d36b037cc133719fbb5a4e93@redhat.com>
Signed-off-by: Xin Long <ed9bd6f22d2a1e0b1507d3ddc300dc248265d19a@gmail.com>
Signed-off-by: Jiri Pirko <1b548d10035ae428195c41f5d55eedb1437ccd8a@mellanox.com>

jpirko/libteam,jpirko/libteam,jpirko/libteam