diff options
author | Jim Meyering <jim@meyering.net> | 2006-11-13 19:15:43 +0100 |
---|---|---|
committer | Jim Meyering <jim@meyering.net> | 2006-11-13 19:15:43 +0100 |
commit | 7932d2e2d47f5a0543b7ee46a4a6ac76037219c0 (patch) | |
tree | d3a2fc05af7d1cdf6d664093f5241a0e29f6b347 | |
parent | 2061f0484753bb8de0fb9dd5821ee983ceda2e23 (diff) | |
download | coreutils-7932d2e2d47f5a0543b7ee46a4a6ac76037219c0.tar.xz |
* src/sort.c (insertkey): Use xmemdup, rather than xmalloc+assignment.
From Paul Eggert.
-rw-r--r-- | ChangeLog | 3 | ||||
-rw-r--r-- | src/sort.c | 3 |
2 files changed, 4 insertions, 2 deletions
@@ -1,5 +1,8 @@ 2006-11-13 Jim Meyering <jim@meyering.net> + * src/sort.c (insertkey): Use xmemdup, rather than xmalloc+assignment. + From Paul Eggert. + Plug another technically-unimportant leak in sort. * src/sort.c (main): Don't allocate memory for each new key here. (insertkey): Allocate memory for each key here, instead. diff --git a/src/sort.c b/src/sort.c index bdaf032a3..feaf5a5bc 100644 --- a/src/sort.c +++ b/src/sort.c @@ -2105,9 +2105,8 @@ static void insertkey (struct keyfield *key_arg) { struct keyfield **p; - struct keyfield *key = xmalloc (sizeof *key); + struct keyfield *key = xmemdup (key_arg, sizeof *key); - *key = *key_arg; for (p = &keylist; *p; p = &(*p)->next) continue; *p = key; |