Skip to content

Commit

Permalink
Merge pull request #84 from mariux64/fix-invalid-free
Browse files Browse the repository at this point in the history
mxq_job: Fix invalid pointer deref on error path
  • Loading branch information
donald authored Apr 15, 2020
2 parents ac79166 + e2aa076 commit 5d1f3da
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions mxq_job.c
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,7 @@ uint64_t mxq_select_job_from_group(struct mx_mysql *mysql, uint64_t group_id)
struct mx_mysql_bind param = {0};
struct mx_mysql_bind result = {0};
uint64_t job_id;
uint64_t *job_id_out;
uint64_t *job_id_out = NULL;
int res;

char *query =
Expand Down Expand Up @@ -321,7 +321,8 @@ uint64_t mxq_select_job_from_group(struct mx_mysql *mysql, uint64_t group_id)
} else {
job_id=0;
}
free(job_id_out);
if (job_id_out)
free(job_id_out);
return(job_id);
}

Expand Down

0 comments on commit 5d1f3da

Please sign in to comment.