提交 fd61a701 编写于 作者: K Kevin Wolf

job: Add job_delete()

This moves freeing the Job object and its fields from block_job_unref()
to job_delete().
Signed-off-by: NKevin Wolf <kwolf@redhat.com>
Reviewed-by: NMax Reitz <mreitz@redhat.com>
Reviewed-by: NJohn Snow <jsnow@redhat.com>
上级 252291ea
......@@ -261,9 +261,8 @@ void block_job_unref(BlockJob *job)
block_job_detach_aio_context, job);
blk_unref(job->blk);
error_free(job->blocker);
g_free(job->job.id);
assert(!timer_pending(&job->sleep_timer));
g_free(job);
job_delete(&job->job);
}
}
......
......@@ -62,6 +62,9 @@ struct JobDriver {
*/
void *job_create(const char *job_id, const JobDriver *driver, Error **errp);
/** Frees the @job object. */
void job_delete(Job *job);
/** Returns the JobType of a given Job. */
JobType job_type(const Job *job);
......
......@@ -56,3 +56,9 @@ void *job_create(const char *job_id, const JobDriver *driver, Error **errp)
return job;
}
void job_delete(Job *job)
{
g_free(job->id);
g_free(job);
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册