Blame SOURCES/kvm-job-Add-job_delete.patch

357786
From 6828f21b1fda85e52bbbe92b4a37f1fde5de5ff0 Mon Sep 17 00:00:00 2001
357786
From: Kevin Wolf <kwolf@redhat.com>
357786
Date: Tue, 26 Jun 2018 09:48:02 +0200
357786
Subject: [PATCH 33/89] job: Add job_delete()
357786
357786
RH-Author: Kevin Wolf <kwolf@redhat.com>
357786
Message-id: <20180626094856.6924-20-kwolf@redhat.com>
357786
Patchwork-id: 81065
357786
O-Subject: [RHV-7.6 qemu-kvm-rhev PATCH v2 19/73] job: Add job_delete()
357786
Bugzilla: 1513543
357786
RH-Acked-by: Jeffrey Cody <jcody@redhat.com>
357786
RH-Acked-by: Max Reitz <mreitz@redhat.com>
357786
RH-Acked-by: Fam Zheng <famz@redhat.com>
357786
357786
This moves freeing the Job object and its fields from block_job_unref()
357786
to job_delete().
357786
357786
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
357786
Reviewed-by: Max Reitz <mreitz@redhat.com>
357786
Reviewed-by: John Snow <jsnow@redhat.com>
357786
(cherry picked from commit fd61a701f1de8e4c1d89b3716ba9ca749cf5c724)
357786
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
357786
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
357786
---
357786
 blockjob.c         | 3 +--
357786
 include/qemu/job.h | 3 +++
357786
 job.c              | 6 ++++++
357786
 3 files changed, 10 insertions(+), 2 deletions(-)
357786
357786
diff --git a/blockjob.c b/blockjob.c
357786
index ea71ec0..430a67b 100644
357786
--- a/blockjob.c
357786
+++ b/blockjob.c
357786
@@ -261,9 +261,8 @@ void block_job_unref(BlockJob *job)
357786
                                         block_job_detach_aio_context, job);
357786
         blk_unref(job->blk);
357786
         error_free(job->blocker);
357786
-        g_free(job->job.id);
357786
         assert(!timer_pending(&job->sleep_timer));
357786
-        g_free(job);
357786
+        job_delete(&job->job);
357786
     }
357786
 }
357786
 
357786
diff --git a/include/qemu/job.h b/include/qemu/job.h
357786
index 279ce68..43dc2e4 100644
357786
--- a/include/qemu/job.h
357786
+++ b/include/qemu/job.h
357786
@@ -62,6 +62,9 @@ struct JobDriver {
357786
  */
357786
 void *job_create(const char *job_id, const JobDriver *driver, Error **errp);
357786
 
357786
+/** Frees the @job object. */
357786
+void job_delete(Job *job);
357786
+
357786
 /** Returns the JobType of a given Job. */
357786
 JobType job_type(const Job *job);
357786
 
357786
diff --git a/job.c b/job.c
357786
index 83724a4..cfdd008 100644
357786
--- a/job.c
357786
+++ b/job.c
357786
@@ -56,3 +56,9 @@ void *job_create(const char *job_id, const JobDriver *driver, Error **errp)
357786
 
357786
     return job;
357786
 }
357786
+
357786
+void job_delete(Job *job)
357786
+{
357786
+    g_free(job->id);
357786
+    g_free(job);
357786
+}
357786
-- 
357786
1.8.3.1
357786