[gparted] Fix null pointer check accidentally disabled (#796293)



commit 2d853b46c1c3b1cad66c13d6f9ad921cd9d78977
Author: Robert Ancell <robert ancell canonical com>
Date:   Mon May 21 14:20:54 2018 +1200

    Fix null pointer check accidentally disabled (#796293)
    
    Compiling (with new enough g++) produces this warning:
    
        PasswordRAMStore.cc: In member function 'void GParted::PWStore::erase_all()':
        PasswordRAMStore.cc:177:2: warning: this 'if' clause does not guard... [-Wmisleading-indentation]
          if ( protected_mem != NULL );
          ^~
        PasswordRAMStore.cc:193:3: note: ...this statement, but the latter is misleadingly indented as if it 
were guarded by the 'if'
           memset( protected_mem, '\0', ProtectedMemSize );
           ^~~~~~
    
    Looks like a stray semicolon...
    
    Bug 796293 - Fix null pointer check accidentally disabled

 src/PasswordRAMStore.cc |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
---
diff --git a/src/PasswordRAMStore.cc b/src/PasswordRAMStore.cc
index 917bc2a..dfda8c4 100644
--- a/src/PasswordRAMStore.cc
+++ b/src/PasswordRAMStore.cc
@@ -174,7 +174,7 @@ PWStore::iterator PWStore::find_key( const Glib::ustring & key )
 void PWStore::erase_all()
 {
        pw_entries.clear();
-       if ( protected_mem != NULL );
+       if ( protected_mem != NULL )
                // WARNING:
                // memset() can be optimised away if the compiler knows the memory is not
                // accessed again.  In this case this memset() is in a separate method


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