job: Fix memory errors

- Free memory allocated for job data when the job table is full.
This commit is contained in:
oni-link 2015-03-12 08:12:29 -03:00 committed by Thiago de Arruda
parent cdedd89d22
commit 727f524167

View File

@ -19831,17 +19831,18 @@ static inline JobOptions common_job_options(char **argv, char *autocmd_file)
static inline Job *common_job_start(JobOptions opts, typval_T *rettv)
{
Job *job = job_start(opts, &rettv->vval.v_number);
TerminalJobData *data = opts.data;
data->refcount++;
Job *job = job_start(opts, &rettv->vval.v_number);
if (rettv->vval.v_number <= 0) {
if (rettv->vval.v_number == 0) {
EMSG(_(e_jobtblfull));
free(opts.term_name);
free(data->autocmd_file);
free(data);
} else {
EMSG(_(e_jobexe));
free(opts.data);
}
return NULL;
}