Skip to content

Commit

Permalink
Coverity: points out that the normal return path does a double free
Browse files Browse the repository at this point in the history
In b31fc3e 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 <[email protected]>
  • Loading branch information
rgetz committed Apr 27, 2020
1 parent a613dd0 commit 7f0bcd0
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions examples/iio-monitor.c
Original file line number Diff line number Diff line change
Expand Up @@ -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])
Expand Down

0 comments on commit 7f0bcd0

Please sign in to comment.