diff options
Diffstat (limited to 'src/cmd')
-rw-r--r-- | src/cmd/dc.c | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/src/cmd/dc.c b/src/cmd/dc.c index bdcfadee..fa7f09bc 100644 --- a/src/cmd/dc.c +++ b/src/cmd/dc.c @@ -2103,14 +2103,13 @@ copy(Blk *hptr, int size) if(size > maxsize) maxsize = size; sz = length(hptr); - ptr = nalloc(hptr->beg, size); + ptr = malloc(size); if(ptr == 0) { - garbage("copy"); - if((ptr = nalloc(hptr->beg, size)) == 0) { - Bprint(&bout,"copy size %d\n",size); - 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) hdr = morehd(); hfree = (Blk *)hdr->rd; |