Message ID | 1407349101-27793-2-git-send-email-ehabkost@redhat.com |
---|---|
State | New |
Headers | show |
On Wed, Aug 06, 2014 at 03:18:20PM -0300, Eduardo Habkost wrote: > Reviewed-by: Markus Armbruster <armbru@redhat.com> > Signed-off-by: Eduardo Habkost <ehabkost@redhat.com> > --- > backends/rng-egd.c | 1 + > 1 file changed, 1 insertion(+) > > diff --git a/backends/rng-egd.c b/backends/rng-egd.c > index 25bb3b4..2962795 100644 > --- a/backends/rng-egd.c > +++ b/backends/rng-egd.c > @@ -169,6 +169,7 @@ static void rng_egd_set_chardev(Object *obj, const char *value, Error **errp) > if (b->opened) { > error_set(errp, QERR_PERMISSION_DENIED); > } else { > + g_free(s->chr_name); > s->chr_name = g_strdup(value); > } > } Eduardo, a similar patch had been applied. commit 5e490b6a504912225dff0e520e1c6af68295d238 Author: Amos Kong <akong@redhat.com> Date: Thu Nov 21 16:42:50 2013 +0800 rng-egd: remove redundant free We didn't set default chr_name, the free is redundant. Signed-off-by: Amos Kong <akong@redhat.com> Message-id: 1385023371-8198-2-git-send-email-akong@redhat.com Signed-off-by: Anthony Liguori <aliguori@amazon.com> > -- > 1.9.3
Il 07/08/2014 04:24, Amos Kong ha scritto: > Eduardo, a similar patch had been applied. > > commit 5e490b6a504912225dff0e520e1c6af68295d238 > Author: Amos Kong <akong@redhat.com> > Date: Thu Nov 21 16:42:50 2013 +0800 > > rng-egd: remove redundant free > > We didn't set default chr_name, the free is redundant. > > Signed-off-by: Amos Kong <akong@redhat.com> > Message-id: 1385023371-8198-2-git-send-email-akong@redhat.com > Signed-off-by: Anthony Liguori <aliguori@amazon.com> > What if you set chr_name twice? Paolo
On Thu, Aug 07, 2014 at 12:18:47PM +0200, Paolo Bonzini wrote: > Il 07/08/2014 04:24, Amos Kong ha scritto: > > Eduardo, a similar patch had been applied. > > > > commit 5e490b6a504912225dff0e520e1c6af68295d238 > > Author: Amos Kong <akong@redhat.com> > > Date: Thu Nov 21 16:42:50 2013 +0800 > > > > rng-egd: remove redundant free > > > > We didn't set default chr_name, the free is redundant. > > > > Signed-off-by: Amos Kong <akong@redhat.com> > > Message-id: 1385023371-8198-2-git-send-email-akong@redhat.com > > Signed-off-by: Anthony Liguori <aliguori@amazon.com> > > > > What if you set chr_name twice? In this case, g_free() is necessary. So I'm fine with Eduardo's patch: [PATCH RESEND 1/2] rng-egd: Free old chr_name value > Paolo
diff --git a/backends/rng-egd.c b/backends/rng-egd.c index 25bb3b4..2962795 100644 --- a/backends/rng-egd.c +++ b/backends/rng-egd.c @@ -169,6 +169,7 @@ static void rng_egd_set_chardev(Object *obj, const char *value, Error **errp) if (b->opened) { error_set(errp, QERR_PERMISSION_DENIED); } else { + g_free(s->chr_name); s->chr_name = g_strdup(value); } }