Skip to content

Commit

Permalink
Fix some missing copies in Clone
Browse files Browse the repository at this point in the history
  • Loading branch information
nono committed Jul 2, 2018
1 parent 299c863 commit 15fe4ce
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
3 changes: 3 additions & 0 deletions pkg/instance/instance.go
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,9 @@ func (i *Instance) SetRev(v string) { i.DocRev = v }
func (i *Instance) Clone() couchdb.Doc {
cloned := *i

cloned.DomainAliases = make([]string, len(i.DomainAliases))
copy(cloned.DomainAliases, i.DomainAliases)

cloned.PassphraseHash = make([]byte, len(i.PassphraseHash))
copy(cloned.PassphraseHash, i.PassphraseHash)

Expand Down
2 changes: 2 additions & 0 deletions pkg/notification/notifications.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,8 @@ func (n *Notification) Clone() couchdb.Doc {
for k, v := range n.Data {
cloned.Data[k] = v
}
cloned.PreferredChannels = make([]string, len(n.PreferredChannels))
copy(cloned.PreferredChannels, n.PreferredChannels)
return &cloned
}

Expand Down

0 comments on commit 15fe4ce

Please sign in to comment.