]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/pprof: fix crash with invalid source
authorEgon Elbre <egonelbre@gmail.com>
Sat, 12 Mar 2016 19:09:14 +0000 (21:09 +0200)
committerBrad Fitzpatrick <bradfitz@golang.org>
Sun, 13 Mar 2016 20:38:16 +0000 (20:38 +0000)
pprof crashed when running with:

     go tool pprof %INVALID

Change-Id: I47c2a4da7273e3a97a833f320a650b8c6b59d6b9
Reviewed-on: https://go-review.googlesource.com/20632
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
src/cmd/pprof/internal/driver/driver.go

index df6a2d18b25a837acc283d60601f757405ae3c95..7cd1ddc9281a9da8ca4230f94501f6ec637accc1 100644 (file)
@@ -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" {