1
0
mirror of https://github.com/golang/go synced 2024-11-25 10:57:58 -07:00

5l, 6l, 8l, ld: remove memory leaks

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/5569085
This commit is contained in:
Shenghou Ma 2012-01-29 12:46:26 -05:00 committed by Russ Cox
parent ba31d662fe
commit 916eea04f8
4 changed files with 4 additions and 0 deletions

View File

@ -91,6 +91,7 @@ needlib(char *name)
/* reuse hash code in symbol table */ /* reuse hash code in symbol table */
p = smprint(".dynlib.%s", name); p = smprint(".dynlib.%s", name);
s = lookup(p, 0); s = lookup(p, 0);
free(p);
if(s->type == 0) { if(s->type == 0) {
s->type = 100; // avoid SDATA, etc. s->type = 100; // avoid SDATA, etc.
return 1; return 1;

View File

@ -112,6 +112,7 @@ needlib(char *name)
/* reuse hash code in symbol table */ /* reuse hash code in symbol table */
p = smprint(".elfload.%s", name); p = smprint(".elfload.%s", name);
s = lookup(p, 0); s = lookup(p, 0);
free(p);
if(s->type == 0) { if(s->type == 0) {
s->type = 100; // avoid SDATA, etc. s->type = 100; // avoid SDATA, etc.
return 1; return 1;

View File

@ -108,6 +108,7 @@ needlib(char *name)
/* reuse hash code in symbol table */ /* reuse hash code in symbol table */
p = smprint(".dynlib.%s", name); p = smprint(".dynlib.%s", name);
s = lookup(p, 0); s = lookup(p, 0);
free(p);
if(s->type == 0) { if(s->type == 0) {
s->type = 100; // avoid SDATA, etc. s->type = 100; // avoid SDATA, etc.
return 1; return 1;

View File

@ -482,6 +482,7 @@ loaddynimport(char *file, char *pkg, char *p, int n)
if(q) if(q)
*q++ = '\0'; *q++ = '\0';
s = lookup(name, 0); s = lookup(name, 0);
free(name);
if(s->type == 0 || s->type == SXREF) { if(s->type == 0 || s->type == SXREF) {
s->dynimplib = lib; s->dynimplib = lib;
s->dynimpname = def; s->dynimpname = def;