bug-coreutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#6901: [Patch]Memory Leak in chown-core.c


From: William Plusnick
Subject: bug#6901: [Patch]Memory Leak in chown-core.c
Date: Mon, 23 Aug 2010 23:31:27 -0500

There was a small memory leak in chown-core.c in the describe_change
function that would occur in cases where memory was allocated to
spec_allocated, but is passed an invalid Change_status. In that case it gets
to the default case and simply aborted without ever deallocating the memory.

Is there any real momentum towards actually deprecating the verbose option
on ch*? (I know we have been using ch???, but ch???? would look funny and
unintuitive.)

>From 64f53a193c9c075e6461711a42d8df33ba01407a Mon Sep 17 00:00:00 2001
From: Patrick W. Plusnick II <address@hidden>
Date: Mon, 23 Aug 2010 13:32:20 -0500
Subject: [PATCH] chown, chgrp: fixed a small, unlikely to occur memory leak

*chown-core.c: fixed a small memory leak that would occur in
describe-change.
If it got to the default case and allocated memory to spec_alloc it would
never deallocate it.
---
 src/chown-core.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/src/chown-core.c b/src/chown-core.c
index 1d3f74c..0e2bad4 100644
--- a/src/chown-core.c
+++ b/src/chown-core.c
@@ -157,6 +157,7 @@ describe_change (const char *file, enum Change_status
changed,
              : _("ownership of %s retained\n"));
       break;
     default:
+      free (spec_allocated);
       abort ();
     }

-- 
1.7.0.4



-- 
"Once GNU is written, everyone will be able to obtain good system software
free, just like air."-- RMS in the GNU Manifesto


reply via email to

[Prev in Thread] Current Thread [Next in Thread]