diff options
author | Jim Meyering <jim@meyering.net> | 1999-07-27 14:36:36 +0000 |
---|---|---|
committer | Jim Meyering <jim@meyering.net> | 1999-07-27 14:36:36 +0000 |
commit | eb8c7c7924ae57651bac76cf32bd7ab2a03a591d (patch) | |
tree | 85109c9305cb009ebc21a30b9c4f20c4636cf492 /src | |
parent | bf94a704bc6a977f0ce25b1ab04a7123ec43169d (diff) | |
download | coreutils-eb8c7c7924ae57651bac76cf32bd7ab2a03a591d.tar.xz |
(dd_copy): Free the right obuf.
Diffstat (limited to 'src')
-rw-r--r-- | src/dd.c | 10 |
1 files changed, 6 insertions, 4 deletions
@@ -850,6 +850,7 @@ dd_copy (void) { unsigned char *ibuf, *bufstart; /* Input buffer. */ unsigned char *real_buf; /* real buffer address before alignment */ + unsigned char *real_obuf; int nread; /* Bytes read in the current block. */ int exit_status = 0; size_t page_size = getpagesize (); @@ -882,11 +883,12 @@ dd_copy (void) if (conversions_mask & C_TWOBUFS) { /* Page-align the output buffer, too. */ - obuf = (unsigned char *) xmalloc (output_blocksize + page_size - 1); - obuf = PTR_ALIGN (obuf, page_size); + real_obuf = (unsigned char *) xmalloc (output_blocksize + page_size - 1); + obuf = PTR_ALIGN (real_obuf, page_size); } else { + real_obuf = NULL; obuf = ibuf; } @@ -1034,8 +1036,8 @@ dd_copy (void) } free (real_buf); - if (obuf != ibuf) - free (obuf); + if (real_obuf) + free (real_obuf); return exit_status; } |