From: Jim Meyering Date: Mon, 13 Nov 2006 18:15:43 +0000 (+0100) Subject: * src/sort.c (insertkey): Use xmemdup, rather than xmalloc+assignment. X-Git-Tag: COREUTILS-6_5~13 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=7932d2e2d47f5a0543b7ee46a4a6ac76037219c0;p=thirdparty%2Fcoreutils.git * src/sort.c (insertkey): Use xmemdup, rather than xmalloc+assignment. From Paul Eggert. --- diff --git a/ChangeLog b/ChangeLog index e737ee1739..c4e225296c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,8 @@ 2006-11-13 Jim Meyering + * 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 bdaf032a3c..feaf5a5bc1 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;