Close exported pin on export failure

This commit is contained in:
Felipe Ramos (perenecabuto) 2016-09-10 22:33:06 -03:00
parent 1a49faafdd
commit 7368ec8726
1 changed files with 5 additions and 0 deletions

View File

@ -43,6 +43,11 @@ func (p *digitalPin) init() error {
if p.initialized {
return nil
}
defer func() {
if !p.initialized {
p.unexport()
}
}()
var err error
if err = p.export(); err != nil {