• Marco Leogrande's avatar
    Fix warnings covered by -Wdelete-non-virtual-dtor · 899520c3
    Marco Leogrande authored
    The warnings were:
    
     src/cc/bcc_syms.cc: In function ‘void bcc_free_symcache(void*, int)’:
     src/cc/bcc_syms.cc:217:40: warning: deleting object of polymorphic class type ‘KSyms’
                                which has non-virtual destructor might cause undefined behaviour
                                [-Wdelete-non-virtual-dtor]
         delete static_cast<KSyms*>(symcache);
                                            ^
     src/cc/bcc_syms.cc:219:43: warning: deleting object of polymorphic class type ‘ProcSyms’
                                which has non-virtual destructor might cause undefined behaviour
                                [-Wdelete-non-virtual-dtor]
         delete static_cast<ProcSyms*>(symcache);
                                               ^
    
    Fix the warnings by defining a virtual destructor for the base class SymbolCache.
    Signed-off-by: default avatarMarco Leogrande <marcol@plumgrid.com>
    899520c3
syms.h 3.13 KB