From: Egon Elbre Date: Sat, 12 Mar 2016 19:09:14 +0000 (+0200) Subject: cmd/pprof: fix crash with invalid source X-Git-Tag: go1.7beta1~1362 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=69f49e1cbcc38be1abb4bd8b2bd3376f53cc55c3;p=gostls13.git cmd/pprof: fix crash with invalid source pprof crashed when running with: go tool pprof %INVALID Change-Id: I47c2a4da7273e3a97a833f320a650b8c6b59d6b9 Reviewed-on: https://go-review.googlesource.com/20632 Reviewed-by: Brad Fitzpatrick --- diff --git a/src/cmd/pprof/internal/driver/driver.go b/src/cmd/pprof/internal/driver/driver.go index df6a2d18b2..7cd1ddc928 100644 --- a/src/cmd/pprof/internal/driver/driver.go +++ b/src/cmd/pprof/internal/driver/driver.go @@ -139,7 +139,7 @@ func adjustURL(source string, sec int, ui plugin.UI) (adjusted, host string, dur if err != nil || (url.Host == "" && url.Scheme != "" && url.Scheme != "file") { url, err = url.Parse("http://" + source) if err != nil { - return source, url.Host, time.Duration(30) * time.Second + return source, "", 0 } } if scheme := strings.ToLower(url.Scheme); scheme == "" || scheme == "file" {