Skip to content

Commit

Permalink
Merge branch 'master' into brendangregg-patch-1
Browse files Browse the repository at this point in the history
  • Loading branch information
brendangregg committed Feb 5, 2016
2 parents d924d3e + 02553a0 commit 1f01cad
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/cc/bpf_module.cc
Original file line number Diff line number Diff line change
Expand Up @@ -114,9 +114,11 @@ BPFModule::~BPFModule() {
engine_.reset();
rw_engine_.reset();
ctx_.reset();
for (auto table : *tables_) {
if (table.is_shared)
SharedTables::instance()->remove_fd(table.name);
if (tables_) {
for (auto table : *tables_) {
if (table.is_shared)
SharedTables::instance()->remove_fd(table.name);
}
}
}

Expand Down
4 changes: 4 additions & 0 deletions tests/cc/test_clang.py
Original file line number Diff line number Diff line change
Expand Up @@ -299,5 +299,9 @@ def test_exported_maps(self):
b1 = BPF(text="""BPF_TABLE_PUBLIC("hash", int, int, table1, 10);""")
b2 = BPF(text="""BPF_TABLE("extern", int, int, table1, 10);""")

def test_syntax_error(self):
with self.assertRaises(Exception):
b = BPF(text="""int failure(void *ctx) { if (); return 0; }""")

if __name__ == "__main__":
main()

0 comments on commit 1f01cad

Please sign in to comment.