Commit 40522e0
committed
Fix memory corruption in io.Writer interface
When hooked up to logrus and running multiple log.Info() calls (for example),
the bytearray being passed to Write() is reused in the successive calls. As
this reference was being passed down through the channel, it resulted in
corrupted data and JSON serialization errors.
We fix that here by always making a copy before sending to the channel.1 parent 49a10eb commit 40522e0
1 file changed
+5
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
50 | 50 | | |
51 | 51 | | |
52 | 52 | | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
53 | 57 | | |
54 | 58 | | |
55 | | - | |
| 59 | + | |
56 | 60 | | |
57 | 61 | | |
58 | 62 | | |
| |||
0 commit comments