backtrace: Remove name checks after SymFromAddr() calls
authorTobias Brunner <tobias@strongswan.org>
Wed, 2 Jul 2014 09:31:56 +0000 (11:31 +0200)
committerTobias Brunner <tobias@strongswan.org>
Wed, 2 Jul 2014 10:11:59 +0000 (12:11 +0200)
The Name member is an array whose address is always defined.

src/libstrongswan/utils/backtrace.c

index 65e7416..e694cae 100644 (file)
@@ -492,8 +492,7 @@ METHOD(backtrace_t, log_, void,
 
                if (module && GetModuleFileName(module, filename, sizeof(filename)))
                {
-                       if (SymFromAddr(process, frame, &displace, &symbol.hdr) &&
-                               symbol.hdr.Name)
+                       if (SymFromAddr(process, frame, &displace, &symbol.hdr))
                        {
                                println(file, "  %s%s%s @ %p (%s%s%s+0x%tx) [%p]",
                                                esc(file, TTY_FG_YELLOW), filename,
@@ -615,15 +614,12 @@ METHOD(backtrace_t, contains_function, bool,
 
                if (SymFromAddr(process, (DWORD64)this->frames[i], NULL, &symbol.hdr))
                {
-                       if (symbol.hdr.Name)
+                       for (j = 0; j < count; j++)
                        {
-                               for (j = 0; j < count; j++)
+                               if (streq(symbol.hdr.Name, function[j]))
                                {
-                                       if (streq(symbol.hdr.Name, function[j]))
-                                       {
-                                               dbghelp_mutex->unlock(dbghelp_mutex);
-                                               return TRUE;
-                                       }
+                                       dbghelp_mutex->unlock(dbghelp_mutex);
+                                       return TRUE;
                                }
                        }
                }