fix issues pointed out by:
  valgrind --tool=memcheck --leak-check=full --show-reachable=yes

Signed-off-by: Robin Getz <robin.getz@analog.com>