ALL: Fix some issues in iio_utils, in the sort and insert algorithms
     that were causing random memory errors. This makes the debug
     and DMM plugins more robust

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