Skip to content

Commit 6faeed2

Browse files
authored
Merge pull request #3 from basil-eldho/fix-resource-leak
2 parents 402f2b9 + ed42b89 commit 6faeed2

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@
55
*.so
66
*.dylib
77

8+
# IDE related
9+
.idea
10+
811
# Test binary, built with `go test -c`
912
*.test
1013

internal/client/client.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,14 +37,15 @@ func (client *Client) Run(terminate chan<- error, routineUpdate chan<- []model.G
3737
terminate <- fmt.Errorf("Failed to list go routines. Err: %s", err.Error())
3838
return
3939
}
40-
defer resp.Body.Close()
4140

4241
goroutines, err := model.ParseStackFrame(resp.Body)
4342
if err != nil {
4443
log.Printf("Error while parsing stack: %s", err.Error())
4544
} else {
4645
routineUpdate <- goroutines
4746
}
47+
48+
resp.Body.Close()
4849
<-ticker.C
4950
}
5051
}

0 commit comments

Comments
 (0)