diff mbox

hostmem-file: plug a small leak

Message ID 1460566660-19241-1-git-send-email-marcandre.lureau@redhat.com (mailing list archive)
State New, archived
Headers show

Commit Message

Marc-André Lureau April 13, 2016, 4:57 p.m. UTC
From: Marc-André Lureau <marcandre.lureau@redhat.com>

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
---
 backends/hostmem-file.c | 8 ++++++++
 1 file changed, 8 insertions(+)

Comments

Igor Mammedov April 14, 2016, 11:34 a.m. UTC | #1
On Wed, 13 Apr 2016 18:57:40 +0200
marcandre.lureau@redhat.com wrote:

> From: Marc-André Lureau <marcandre.lureau@redhat.com>
> 
> Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Igor Mammedov <imammedo@redhat.com>

> ---
>  backends/hostmem-file.c | 8 ++++++++
>  1 file changed, 8 insertions(+)
> 
> diff --git a/backends/hostmem-file.c b/backends/hostmem-file.c
> index b17a1f1..5c4b808 100644
> --- a/backends/hostmem-file.c
> +++ b/backends/hostmem-file.c
> @@ -121,11 +121,19 @@ file_backend_instance_init(Object *o)
>                              set_mem_path, NULL);
>  }
>  
> +static void file_backend_instance_finalize(Object *o)
> +{
> +    HostMemoryBackendFile *fb = MEMORY_BACKEND_FILE(o);
> +
> +    g_free(fb->mem_path);
> +}
> +
>  static const TypeInfo file_backend_info = {
>      .name = TYPE_MEMORY_BACKEND_FILE,
>      .parent = TYPE_MEMORY_BACKEND,
>      .class_init = file_backend_class_init,
>      .instance_init = file_backend_instance_init,
> +    .instance_finalize = file_backend_instance_finalize,
>      .instance_size = sizeof(HostMemoryBackendFile),
>  };
>
Paolo Bonzini April 14, 2016, 1:24 p.m. UTC | #2
On 14/04/2016 13:34, Igor Mammedov wrote:
> On Wed, 13 Apr 2016 18:57:40 +0200
> marcandre.lureau@redhat.com wrote:
> 
>> From: Marc-André Lureau <marcandre.lureau@redhat.com>
>>
>> Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
> Reviewed-by: Igor Mammedov <imammedo@redhat.com>

Igor, feel free to send a pull request or even to add yourself as
hostmem maintainer.

Paolo
Igor Mammedov April 14, 2016, 3:44 p.m. UTC | #3
On Thu, 14 Apr 2016 15:24:10 +0200
Paolo Bonzini <pbonzini@redhat.com> wrote:

> On 14/04/2016 13:34, Igor Mammedov wrote:
> > On Wed, 13 Apr 2016 18:57:40 +0200
> > marcandre.lureau@redhat.com wrote:
> >   
> >> From: Marc-André Lureau <marcandre.lureau@redhat.com>
> >>
> >> Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>  
> > Reviewed-by: Igor Mammedov <imammedo@redhat.com>  
> 
> Igor, feel free to send a pull request or even to add yourself as
> hostmem maintainer.
I can't send pull signed pull request as I don't have a trusted key.

> 
> Paolo
Paolo Bonzini April 14, 2016, 5:26 p.m. UTC | #4
On 14/04/2016 17:44, Igor Mammedov wrote:
> On Thu, 14 Apr 2016 15:24:10 +0200
> Paolo Bonzini <pbonzini@redhat.com> wrote:
> 
>> On 14/04/2016 13:34, Igor Mammedov wrote:
>>> On Wed, 13 Apr 2016 18:57:40 +0200
>>> marcandre.lureau@redhat.com wrote:
>>>   
>>>> From: Marc-André Lureau <marcandre.lureau@redhat.com>
>>>>
>>>> Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>  
>>> Reviewed-by: Igor Mammedov <imammedo@redhat.com>  
>>
>> Igor, feel free to send a pull request or even to add yourself as
>> hostmem maintainer.
> I can't send pull signed pull request as I don't have a trusted key.

Ok, then I guess this will have to wait for 2.7.  No big deal, it's
really minor.  Marc-André, please remind me when I'm back. :)

Paolo
Markus Armbruster April 15, 2016, 6:56 a.m. UTC | #5
Paolo Bonzini <pbonzini@redhat.com> writes:

> On 14/04/2016 17:44, Igor Mammedov wrote:
>> On Thu, 14 Apr 2016 15:24:10 +0200
>> Paolo Bonzini <pbonzini@redhat.com> wrote:
>> 
>>> On 14/04/2016 13:34, Igor Mammedov wrote:
>>>> On Wed, 13 Apr 2016 18:57:40 +0200
>>>> marcandre.lureau@redhat.com wrote:
>>>>   
>>>>> From: Marc-André Lureau <marcandre.lureau@redhat.com>
>>>>>
>>>>> Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>  
>>>> Reviewed-by: Igor Mammedov <imammedo@redhat.com>  
>>>
>>> Igor, feel free to send a pull request or even to add yourself as
>>> hostmem maintainer.
>> I can't send pull signed pull request as I don't have a trusted key.

Needs fixing.

> Ok, then I guess this will have to wait for 2.7.  No big deal, it's
> really minor.  Marc-André, please remind me when I'm back. :)

Yes, no big deal, but I could do a pull request for 2.6 if that's okay
with Paolo.
Paolo Bonzini April 15, 2016, 1:49 p.m. UTC | #6
On 15/04/2016 08:56, Markus Armbruster wrote:
> Paolo Bonzini <pbonzini@redhat.com> writes:
> 
>> On 14/04/2016 17:44, Igor Mammedov wrote:
>>> On Thu, 14 Apr 2016 15:24:10 +0200
>>> Paolo Bonzini <pbonzini@redhat.com> wrote:
>>>
>>>> On 14/04/2016 13:34, Igor Mammedov wrote:
>>>>> On Wed, 13 Apr 2016 18:57:40 +0200
>>>>> marcandre.lureau@redhat.com wrote:
>>>>>   
>>>>>> From: Marc-André Lureau <marcandre.lureau@redhat.com>
>>>>>>
>>>>>> Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>  
>>>>> Reviewed-by: Igor Mammedov <imammedo@redhat.com>  
>>>>
>>>> Igor, feel free to send a pull request or even to add yourself as
>>>> hostmem maintainer.
>>> I can't send pull signed pull request as I don't have a trusted key.
> 
> Needs fixing.
> 
>> Ok, then I guess this will have to wait for 2.7.  No big deal, it's
>> really minor.  Marc-André, please remind me when I'm back. :)
> 
> Yes, no big deal, but I could do a pull request for 2.6 if that's okay
> with Paolo.

I'm always okay with doing less work, and I obviously trust anyone who
has already sent a pull request to Peter (plus some that haven't).

Paolo
diff mbox

Patch

diff --git a/backends/hostmem-file.c b/backends/hostmem-file.c
index b17a1f1..5c4b808 100644
--- a/backends/hostmem-file.c
+++ b/backends/hostmem-file.c
@@ -121,11 +121,19 @@  file_backend_instance_init(Object *o)
                             set_mem_path, NULL);
 }
 
+static void file_backend_instance_finalize(Object *o)
+{
+    HostMemoryBackendFile *fb = MEMORY_BACKEND_FILE(o);
+
+    g_free(fb->mem_path);
+}
+
 static const TypeInfo file_backend_info = {
     .name = TYPE_MEMORY_BACKEND_FILE,
     .parent = TYPE_MEMORY_BACKEND,
     .class_init = file_backend_class_init,
     .instance_init = file_backend_instance_init,
+    .instance_finalize = file_backend_instance_finalize,
     .instance_size = sizeof(HostMemoryBackendFile),
 };