[Parted-commits] GNU Parted Official Repository: Changes to 'debian/master'
Otavio Salvador
otavio at alioth.debian.org
Thu Apr 24 20:09:13 UTC 2008
libparted/exception.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
New commits:
commit 91a6b628e241e41a06242f91b146334a7b32bad3
Author: Otavio Salvador <otavio at ossystems.com.br>
Date: Thu Apr 24 15:55:47 2008 -0300
fix memory leak in exception handler
The exception handler wasn't freeing the memory when the allocated
space wasn't enough to store the error message thus leaving unmanaged
memory around.
(cherry picked from commit abc24c32fc7bca23d9cd2b82b1bcafec6c4b5f21)
diff --git a/libparted/exception.c b/libparted/exception.c
index 0940d65..7e8fa43 100644
--- a/libparted/exception.c
+++ b/libparted/exception.c
@@ -244,7 +244,7 @@ ped_exception_throw (PedExceptionType ex_type,
ex->options = ex_opts;
while (1) {
- ex->message = (char*) malloc (size);
+ ex->message = (char*) malloc (size * sizeof (char));
if (!ex->message)
goto no_memory;
@@ -256,6 +256,7 @@ ped_exception_throw (PedExceptionType ex_type,
break;
size += 10;
+ ped_free (ex->message);
}
return do_throw ();
More information about the Parted-commits
mailing list