SCP: Fix potential leak in error path exit (Coverity)

This commit is contained in:
Mark Pizzolato 2018-10-05 17:32:57 -07:00
parent e994a4aeda
commit 7984074f5f

6
scp.c
View file

@ -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);