Skip to content

Commit

Permalink
Remove unnecessary check for nil CString
Browse files Browse the repository at this point in the history
@noxiouz points out that we don't need to check for a nil result from
C.CString(), since an out-of-memory condition causes a runtime panic
instead.

Signed-off-by: Nalin Dahyabhai <[email protected]> (github: nalind)
  • Loading branch information
nalind committed Sep 14, 2015
1 parent d25dada commit 11fda78
Showing 1 changed file with 0 additions and 4 deletions.
4 changes: 0 additions & 4 deletions daemon/logger/journald/read.go
Original file line number Diff line number Diff line change
Expand Up @@ -220,10 +220,6 @@ func (s *journald) readLogs(logWatcher *logger.LogWatcher, config logger.ReadCon
}
// Add a match to have the library do the searching for us.
cmatch = C.CString("CONTAINER_ID_FULL=" + s.vars["CONTAINER_ID_FULL"])
if cmatch == nil {
logWatcher.Err <- fmt.Errorf("error reading container ID")
return
}
defer C.free(unsafe.Pointer(cmatch))
rc = C.sd_journal_add_match(j, unsafe.Pointer(cmatch), C.strlen(cmatch))
if rc != 0 {
Expand Down

0 comments on commit 11fda78

Please sign in to comment.