From 7f0bcd0755c3de254d80df2e6a07ce42ffe6267e Mon Sep 17 00:00:00 2001 From: Robin Getz Date: Mon, 27 Apr 2020 14:31:42 -0400 Subject: [PATCH] Coverity: points out that the normal return path does a double free In b31fc3e1aa4e93c6c6b2fde9cfa4ee4b541bd3b0 where I added the error paths, all the errors are handled correctly - what I never tested was the normal/sucessful path. On the normal/sucessful path, it does a double free on dev_names (which is a bug). This fixed that by returning in the correct place during a sucessful quit. Signed-off-by: Robin Getz --- examples/iio-monitor.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/examples/iio-monitor.c b/examples/iio-monitor.c index 158ab6347..13dae9ac4 100644 --- a/examples/iio-monitor.c +++ b/examples/iio-monitor.c @@ -398,6 +398,8 @@ static void show_main_screen(struct iio_context *ctx) free(dev_names); destroyCDKScreen(screen); + return; + dev_name_err: for (i = 0; i < nb_devices; i++) { if (dev_names[i])