diff mbox

[2/2] vnc: Drop superfluous conditionals around g_strdup()

Message ID 1402072618-7103-3-git-send-email-armbru@redhat.com
State New
Headers show

Commit Message

Markus Armbruster June 6, 2014, 4:36 p.m. UTC
Signed-off-by: Markus Armbruster <armbru@redhat.com>
---
 ui/vnc.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

Comments

Paolo Bonzini June 6, 2014, 4:38 p.m. UTC | #1
Il 06/06/2014 18:36, Markus Armbruster ha scritto:
> Signed-off-by: Markus Armbruster <armbru@redhat.com>
> ---
>  ui/vnc.c | 4 +---
>  1 file changed, 1 insertion(+), 3 deletions(-)
>
> diff --git a/ui/vnc.c b/ui/vnc.c
> index d771a2c..0853ded 100644
> --- a/ui/vnc.c
> +++ b/ui/vnc.c
> @@ -3010,9 +3010,7 @@ int vnc_display_password(DisplayState *ds, const char *password)
>
>      g_free(vs->password);
>      vs->password = NULL;
> -    if (password) {
> -        vs->password = g_strdup(password);
> -    }
> +    vs->password = g_strdup(password);

You have a dead store now. :)

Paolo

>      return 0;
>  }
>
Markus Armbruster June 6, 2014, 4:48 p.m. UTC | #2
Wrong patch; v2 sent.
Markus Armbruster June 6, 2014, 4:50 p.m. UTC | #3
Paolo Bonzini <pbonzini@redhat.com> writes:

> Il 06/06/2014 18:36, Markus Armbruster ha scritto:
>> Signed-off-by: Markus Armbruster <armbru@redhat.com>
>> ---
>>  ui/vnc.c | 4 +---
>>  1 file changed, 1 insertion(+), 3 deletions(-)
>>
>> diff --git a/ui/vnc.c b/ui/vnc.c
>> index d771a2c..0853ded 100644
>> --- a/ui/vnc.c
>> +++ b/ui/vnc.c
>> @@ -3010,9 +3010,7 @@ int vnc_display_password(DisplayState *ds, const char *password)
>>
>>      g_free(vs->password);
>>      vs->password = NULL;
>> -    if (password) {
>> -        vs->password = g_strdup(password);
>> -    }
>> +    vs->password = g_strdup(password);
>
> You have a dead store now. :)

Noticed right after I sent %-}

Thanks!
diff mbox

Patch

diff --git a/ui/vnc.c b/ui/vnc.c
index d771a2c..0853ded 100644
--- a/ui/vnc.c
+++ b/ui/vnc.c
@@ -3010,9 +3010,7 @@  int vnc_display_password(DisplayState *ds, const char *password)
 
     g_free(vs->password);
     vs->password = NULL;
-    if (password) {
-        vs->password = g_strdup(password);
-    }
+    vs->password = g_strdup(password);
 
     return 0;
 }