From a06aec04b3422d8ec63250e3ac56bbf526bc41b0 Mon Sep 17 00:00:00 2001 From: Bart Van Assche Date: Sat, 4 Jan 2020 14:10:47 -0800 Subject: [PATCH] t/read-to-pipe-async: Complain if option -f is specified multiple times This patch fixes the following Coverity complaint: CID 280676: Resource leaks (RESOURCE_LEAK) Overwriting "file" in "file = strdup(optarg)" leaks the storage that "file" points to. Signed-off-by: Bart Van Assche --- t/read-to-pipe-async.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/t/read-to-pipe-async.c b/t/read-to-pipe-async.c index 69799336..bc7986f7 100644 --- a/t/read-to-pipe-async.c +++ b/t/read-to-pipe-async.c @@ -520,6 +520,8 @@ static int parse_options(int argc, char *argv[]) while ((c = getopt(argc, argv, "f:b:t:w:")) != -1) { switch (c) { case 'f': + if (file) + return usage(argv); file = strdup(optarg); break; case 'b': -- 2.25.1