From 7984074f5fefeb251423e47127262e84e5052b3f Mon Sep 17 00:00:00 2001 From: Mark Pizzolato Date: Fri, 5 Oct 2018 17:32:57 -0700 Subject: [PATCH] SCP: Fix potential leak in error path exit (Coverity) --- scp.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/scp.c b/scp.c index 96bfcc50..2b8cfe34 100644 --- a/scp.c +++ b/scp.c @@ -3501,8 +3501,10 @@ if (flag >= 0) { /* Only bump nesting fro } sim_debug (SIM_DBG_DO, sim_dflt_dev, "do_cmd_label(%d, flag=%d, '%s', '%s')\n", sim_do_depth, flag, fcptr, label ? label : ""); -if (NULL == (c = sim_filepath_parts (cbuf, "f"))) - return SCPE_MEM; +if (NULL == (c = sim_filepath_parts (cbuf, "f"))) { + stat = SCPE_MEM; + goto Cleanup_Return; + } strlcpy( sim_do_filename[sim_do_depth], c, sizeof (sim_do_filename[sim_do_depth])); /* stash away full path of do file name for possible use by 'call' command */ free (c);