mirror of
https://github.com/9fans/plan9port.git
synced 2025-01-24 11:41:58 +00:00
dc: clean up minor memory errors
This commit is contained in:
parent
eb1392208c
commit
ab937b56de
1 changed files with 5 additions and 6 deletions
11
src/cmd/dc.c
11
src/cmd/dc.c
|
@ -2103,14 +2103,13 @@ copy(Blk *hptr, int size)
|
||||||
if(size > maxsize)
|
if(size > maxsize)
|
||||||
maxsize = size;
|
maxsize = size;
|
||||||
sz = length(hptr);
|
sz = length(hptr);
|
||||||
ptr = nalloc(hptr->beg, size);
|
ptr = malloc(size);
|
||||||
if(ptr == 0) {
|
if(ptr == 0) {
|
||||||
garbage("copy");
|
Bprint(&bout,"copy size %d\n",size);
|
||||||
if((ptr = nalloc(hptr->beg, size)) == 0) {
|
ospace("copy");
|
||||||
Bprint(&bout,"copy size %d\n",size);
|
|
||||||
ospace("copy");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
memmove(ptr, hptr->beg, sz);
|
||||||
|
memset(ptr+sz, 0, size-sz);
|
||||||
if((hdr = hfree) == 0)
|
if((hdr = hfree) == 0)
|
||||||
hdr = morehd();
|
hdr = morehd();
|
||||||
hfree = (Blk *)hdr->rd;
|
hfree = (Blk *)hdr->rd;
|
||||||
|
|
Loading…
Reference in a new issue