Fix a memory leak

This commit is contained in:
Michael Steinert
2015-12-04 09:03:39 -06:00
parent 8ec1202046
commit a245f1098c
3 changed files with 31 additions and 10 deletions

View File

@@ -11,6 +11,7 @@ func TestCallback_001(t *testing.T) {
if reflect.TypeOf(v) != reflect.TypeOf(TestCallback_001) {
t.Error("Received unexpected value")
}
cbDelete(c)
}
func TestCallback_002(t *testing.T) {
@@ -21,3 +22,12 @@ func TestCallback_002(t *testing.T) {
cbGet(c + 1)
t.Error("Expected a panic")
}
func TestCallback_003(t *testing.T) {
defer func() {
recover()
}()
c := cbAdd(TestCallback_003)
cbDelete(c + 1)
t.Error("Expected a panic")
}