Skip to content

Commit

Permalink
Reset dec.wrapper to nil before deleting dtor
Browse files Browse the repository at this point in the history
This is so that accidental references from routines that execute as a
result do not cause segmentation fault.  (We are about to add such a
code path.)
  • Loading branch information
Eugene Kim committed Dec 18, 2018
1 parent d27f86f commit 02c09dc
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion pkg/impl/libraptorq/decoder.go
Original file line number Diff line number Diff line change
Expand Up @@ -105,8 +105,8 @@ func (dec *Decoder) FreeSourceBlock(sbn uint8) {
func (dec *Decoder) Close() (err error) {
switch wrapped := dec.wrapped.(type) {
case swig.BytesDecoder:
swig.DeleteBytesDecoder(wrapped)
dec.wrapped = nil
swig.DeleteBytesDecoder(wrapped)
default:
err = errors.New("RaptorQ decoder already closed")
}
Expand Down

0 comments on commit 02c09dc

Please sign in to comment.