From 2dd578cfde8f03c0bd2062a76bbc72ec7d5b4e22 Mon Sep 17 00:00:00 2001 From: sinanmohd Date: Sun, 25 Aug 2024 16:50:22 +0530 Subject: evanix/opts_read: only clean up on error --- src/evanix.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/evanix.c b/src/evanix.c index b4852bb..da517b0 100644 --- a/src/evanix.c +++ b/src/evanix.c @@ -337,12 +337,12 @@ static int opts_read(struct evanix_opts_t *opts, char **expr, int argc, } out_free_evanix: - if (ret != 0) + if (ret < 0) evanix_free(opts); else *expr = argv[optind]; - return ret; + return ret < 0 ? ret : 0; } static int evanix_free(struct evanix_opts_t *opts) -- cgit v1.2.3