[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH] gdbstub: Fix memory leak
From: |
Stuart Brady |
Subject: |
Re: [Qemu-devel] [PATCH] gdbstub: Fix memory leak |
Date: |
Wed, 19 Oct 2011 01:59:04 +0100 |
User-agent: |
Mutt/1.5.21 (2010-09-15) |
On Tue, Oct 18, 2011 at 06:18:11PM +0000, Blue Swirl wrote:
> Cool. Please include the spatch with the commit message.
Thanks, will do!
FWIW, it results in:
51 files changed, 99 insertions(+), 136 deletions(-)
I wonder if that needs splitting up at all?
> IIRC I had also problems with identifiers, I could not get checking
> identifiers against CODING_STYLE to work.
FWIW, I got there in the end:
@@ type T; T *E; @@
-E = g_malloc(sizeof(*E))
+E = g_new(T, 1)
@@ type T; T *E; @@
-E = g_malloc0(sizeof(*E))
+E = g_new0(T, 1)
@@ type T; T *E; expression N; @@
-E = g_malloc(sizeof(*E) * N)
+E = g_new(T, N)
@@ type T; T *E; expression N; @@
-E = g_malloc0(sizeof(*E) * N)
+E = g_new0(T, N)
@@ type T; T *E; @@
-E = g_malloc(sizeof(T))
+E = g_new(T, 1)
@@ type T; T *E; @@
-E = g_malloc0(sizeof(T))
+E = g_new0(T, 1)
@@ type T; T *E; expression N; @@
-E = g_malloc(sizeof(T) * N)
+E = g_new(T, N)
@@ type T; T *E; expression N; @@
-E = g_malloc0(sizeof(T) * N)
+E = g_new0(T, N)
With this added, I get:
246 files changed, 514 insertions(+), 557 deletions(-)
That includes the original 99 insertions and 136 deletions.
I think I should at least submit the patch to convert cases involving
casts as the first part of the patch series, and convert the sizeof(*E)
and sizeof(T) cases as the second and third parts. Sound okay?
Cheers,
--
Stuart Brady