[epiphany/gnome-3-32] Fix crash when username_field is detected with no username



commit b21028cbf4c1428b5acaa40b4943794c3036e7f0
Author: Michael Catanzaro <mcatanzaro igalia com>
Date:   Mon Apr 15 17:50:36 2019 -0500

    Fix crash when username_field is detected with no username
    
    The current code is obviously a mistake -- my bad -- since there's no
    point in freeing a variable that is known to be NULL.

 embed/ephy-embed-shell.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
---
diff --git a/embed/ephy-embed-shell.c b/embed/ephy-embed-shell.c
index f9942e265..b7661339f 100644
--- a/embed/ephy-embed-shell.c
+++ b/embed/ephy-embed-shell.c
@@ -499,12 +499,12 @@ web_extension_password_manager_save_real (EphyEmbedShell *shell,
     return;
 
   /* The username field is required if username is present. */
-  if (username != NULL && username_field == NULL)
-    g_clear_pointer (&username_field, g_free);
+  if (username && !username_field)
+    g_clear_pointer (&username, g_free);
 
   /* The username is required if username field is present. */
-  if (username == NULL && username_field != NULL)
-    g_clear_pointer (&username, g_free);
+  if (!username && username_field)
+    g_clear_pointer (&username_field, g_free);
 
   /* This also sanity checks that a page isn't saving websites for
    * other origins. Remember the request comes from the untrusted web


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]