diff options
| author | Shenghou Ma <minux.ma@gmail.com> | 2012-11-27 03:05:46 +0800 |
|---|---|---|
| committer | Shenghou Ma <minux.ma@gmail.com> | 2012-11-27 03:05:46 +0800 |
| commit | af375cde206ff131acf3e9afd126b36a8ff7b39e (patch) | |
| tree | d5490bf6d640fe7a23cce40d7514ab1a95116a3c /src/cmd/ld | |
| parent | 1de4d313dd4a231a4765b8b5b05113e544df920a (diff) | |
| download | go-af375cde206ff131acf3e9afd126b36a8ff7b39e.tar.xz | |
libmach, cmd/cc, cmd/cov, cmd/ld, cmd/prof: check malloc return value
Update #4415.
R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/6856080
Diffstat (limited to 'src/cmd/ld')
| -rw-r--r-- | src/cmd/ld/dwarf.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/cmd/ld/dwarf.c b/src/cmd/ld/dwarf.c index 9c72f25db7..bb5199fc15 100644 --- a/src/cmd/ld/dwarf.c +++ b/src/cmd/ld/dwarf.c @@ -1297,6 +1297,10 @@ decodez(char *s) return 0; r = malloc(len + 1); + if(r == nil) { + diag("out of memory"); + errorexit(); + } rb = r; re = rb + len + 1; @@ -1475,6 +1479,10 @@ inithist(Auto *a) continue; if (linehist == 0 || linehist->absline != absline) { Linehist* lh = malloc(sizeof *lh); + if(lh == nil) { + diag("out of memory"); + errorexit(); + } lh->link = linehist; lh->absline = absline; linehist = lh; |
