Skip to content

Commit

Permalink
Use new(json.RawMessage) memory in getTargetCustom
Browse files Browse the repository at this point in the history
Signed-off-by: Ashwini Oruganti <[email protected]>
  • Loading branch information
ashfall committed May 8, 2017
1 parent d5319f8 commit cd22029
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions cmd/notary/tuf.go
Original file line number Diff line number Diff line change
Expand Up @@ -255,16 +255,16 @@ func getTargetHashes(t *tufCommander) (data.Hashes, error) {

// Open and read a file containing the targetCustom data
func getTargetCustom(targetCustomFilename string) (*json.RawMessage, error) {
var targetCustom json.RawMessage
targetCustom := new(json.RawMessage)
rawTargetCustom, err := ioutil.ReadFile(targetCustomFilename)
if err != nil {
return nil, err
}
err = json.Unmarshal(rawTargetCustom, &targetCustom)
if err != nil {

if err := targetCustom.UnmarshalJSON(rawTargetCustom); err != nil {
return nil, err
}
return &targetCustom, nil
return targetCustom, nil
}

func (t *tufCommander) tufAddByHash(cmd *cobra.Command, args []string) error {
Expand Down

0 comments on commit cd22029

Please sign in to comment.