Message ID | 1402073264-9606-2-git-send-email-armbru@redhat.com |
---|---|
State | New |
Headers | show |
On 06/06/2014 10:47 AM, Markus Armbruster wrote: > Signed-off-by: Markus Armbruster <armbru@redhat.com> > --- > ui/vnc-tls.c | 6 ++---- > ui/vnc.c | 12 ++++-------- > 2 files changed, 6 insertions(+), 12 deletions(-) > > diff --git a/ui/vnc-tls.c b/ui/vnc-tls.c > index 50275de..6392326 100644 > --- a/ui/vnc-tls.c > +++ b/ui/vnc-tls.c > @@ -443,10 +443,8 @@ static int vnc_set_x509_credential(VncDisplay *vd, > { > struct stat sb; > > - if (*cred) { > - g_free(*cred); > - *cred = NULL; > - } > + g_free(*cred); > + *cred = NULL; > > *cred = g_malloc(strlen(certdir) + strlen(filename) + 2); Still a dead store
Eric Blake <eblake@redhat.com> writes: > On 06/06/2014 10:47 AM, Markus Armbruster wrote: >> Signed-off-by: Markus Armbruster <armbru@redhat.com> >> --- >> ui/vnc-tls.c | 6 ++---- >> ui/vnc.c | 12 ++++-------- >> 2 files changed, 6 insertions(+), 12 deletions(-) >> >> diff --git a/ui/vnc-tls.c b/ui/vnc-tls.c >> index 50275de..6392326 100644 >> --- a/ui/vnc-tls.c >> +++ b/ui/vnc-tls.c >> @@ -443,10 +443,8 @@ static int vnc_set_x509_credential(VncDisplay *vd, >> { >> struct stat sb; >> >> - if (*cred) { >> - g_free(*cred); >> - *cred = NULL; >> - } >> + g_free(*cred); >> + *cred = NULL; >> >> *cred = g_malloc(strlen(certdir) + strlen(filename) + 2); > > Still a dead store No deader than before my patch :) Still, it's as good an opportunity to drop it as any. Gerd, would you like a v3?
> >> + *cred = NULL; > >> > >> *cred = g_malloc(strlen(certdir) + strlen(filename) + 2); > > > > Still a dead store > > No deader than before my patch :) > > Still, it's as good an opportunity to drop it as any. Gerd, would you > like a v3? It's an improvement in any case, so I'm not going to reject it. Nevertheless a v3 would be nice though. cheers, Gerd
diff --git a/ui/vnc-tls.c b/ui/vnc-tls.c index 50275de..6392326 100644 --- a/ui/vnc-tls.c +++ b/ui/vnc-tls.c @@ -443,10 +443,8 @@ static int vnc_set_x509_credential(VncDisplay *vd, { struct stat sb; - if (*cred) { - g_free(*cred); - *cred = NULL; - } + g_free(*cred); + *cred = NULL; *cred = g_malloc(strlen(certdir) + strlen(filename) + 2); diff --git a/ui/vnc.c b/ui/vnc.c index 1684206..d771a2c 100644 --- a/ui/vnc.c +++ b/ui/vnc.c @@ -2972,10 +2972,8 @@ static void vnc_display_close(DisplayState *ds) if (!vs) return; - if (vs->display) { - g_free(vs->display); - vs->display = NULL; - } + g_free(vs->display); + vs->display = NULL; if (vs->lsock != -1) { qemu_set_fd_handler2(vs->lsock, NULL, NULL, NULL, NULL); close(vs->lsock); @@ -3010,10 +3008,8 @@ int vnc_display_password(DisplayState *ds, const char *password) return -EINVAL; } - if (vs->password) { - g_free(vs->password); - vs->password = NULL; - } + g_free(vs->password); + vs->password = NULL; if (password) { vs->password = g_strdup(password); }
Signed-off-by: Markus Armbruster <armbru@redhat.com> --- ui/vnc-tls.c | 6 ++---- ui/vnc.c | 12 ++++-------- 2 files changed, 6 insertions(+), 12 deletions(-)