All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] xl: free default_{vifscript, bridge, gatewaydev} on exit
@ 2013-06-12 12:38 Ian Campbell
  2013-06-12 12:41 ` Ian Jackson
  2013-06-12 13:19 ` George Dunlap
  0 siblings, 2 replies; 5+ messages in thread
From: Ian Campbell @ 2013-06-12 12:38 UTC (permalink / raw)
  To: xen-devel; +Cc: ian.jackson, Ian Campbell, George.Dunlap

These leaks aren't serious, since they are only in xl but this makes "xl list"
clean according to valgrind, which is useful from the point of view of
eliminating false positives when looking at the state of libxl (where leaks
matter).

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Cc: George.Dunlap@citrix.com
---

I'm inclined to suggest that these are 4.4 material.
---
 tools/libxl/xl.c |   15 +++++++++++++++
 1 files changed, 15 insertions(+), 0 deletions(-)

diff --git a/tools/libxl/xl.c b/tools/libxl/xl.c
index 3c141bf..0f3acb9 100644
--- a/tools/libxl/xl.c
+++ b/tools/libxl/xl.c
@@ -276,6 +276,21 @@ static void xl_ctx_free(void)
         free(lockfile);
         lockfile = NULL;
     }
+
+    if (default_vifscript) {
+        free(default_vifscript);
+        default_vifscript = NULL;
+    }
+
+    if (default_bridge) {
+        free(default_bridge);
+        default_bridge = NULL;
+    }
+
+    if (default_gatewaydev) {
+        free(default_gatewaydev);
+        default_gatewaydev = NULL;
+    }
 }
 
 int main(int argc, char **argv)
-- 
1.7.2.5

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] xl: free default_{vifscript, bridge, gatewaydev} on exit
  2013-06-12 12:38 [PATCH] xl: free default_{vifscript, bridge, gatewaydev} on exit Ian Campbell
@ 2013-06-12 12:41 ` Ian Jackson
  2013-06-12 13:08   ` Ian Campbell
  2013-06-12 13:19 ` George Dunlap
  1 sibling, 1 reply; 5+ messages in thread
From: Ian Jackson @ 2013-06-12 12:41 UTC (permalink / raw)
  To: Ian Campbell; +Cc: George.Dunlap, xen-devel

Ian Campbell writes ("[PATCH] xl: free default_{vifscript,bridge,gatewaydev} on exit"):
> These leaks aren't serious, since they are only in xl but this makes "xl list"
> clean according to valgrind, which is useful from the point of view of
> eliminating false positives when looking at the state of libxl (where leaks
> matter).
...
> +    if (default_vifscript) {
> +        free(default_vifscript);
> +        default_vifscript = NULL;

These ifs are unnecessary.  free(NULL) is a no-op.

I would write:

+        free(default_vifscript);   default_vifscript = NULL;
+        free(default_bridge);      default_bridge = NULL;
+        free(default_gatewaydev);  default_gatewaydev = NULL;

which is nice and regular.

Ian.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] xl: free default_{vifscript, bridge, gatewaydev} on exit
  2013-06-12 12:41 ` Ian Jackson
@ 2013-06-12 13:08   ` Ian Campbell
  0 siblings, 0 replies; 5+ messages in thread
From: Ian Campbell @ 2013-06-12 13:08 UTC (permalink / raw)
  To: Ian Jackson; +Cc: George.Dunlap, xen-devel

On Wed, 2013-06-12 at 13:41 +0100, Ian Jackson wrote:
> Ian Campbell writes ("[PATCH] xl: free default_{vifscript,bridge,gatewaydev} on exit"):
> > These leaks aren't serious, since they are only in xl but this makes "xl list"
> > clean according to valgrind, which is useful from the point of view of
> > eliminating false positives when looking at the state of libxl (where leaks
> > matter).
> ...
> > +    if (default_vifscript) {
> > +        free(default_vifscript);
> > +        default_vifscript = NULL;
> 
> These ifs are unnecessary.  free(NULL) is a no-op.
> 
> I would write:
> 
> +        free(default_vifscript);   default_vifscript = NULL;
> +        free(default_bridge);      default_bridge = NULL;
> +        free(default_gatewaydev);  default_gatewaydev = NULL;
> 
> which is nice and regular.

So would I except this is the prevailing style in that function for some
reason (even though I have a feeling I wrote it).

Ian.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] xl: free default_{vifscript, bridge, gatewaydev} on exit
  2013-06-12 12:38 [PATCH] xl: free default_{vifscript, bridge, gatewaydev} on exit Ian Campbell
  2013-06-12 12:41 ` Ian Jackson
@ 2013-06-12 13:19 ` George Dunlap
  2013-06-27  8:50   ` Ian Campbell
  1 sibling, 1 reply; 5+ messages in thread
From: George Dunlap @ 2013-06-12 13:19 UTC (permalink / raw)
  To: Ian Campbell; +Cc: ian.jackson, George.Dunlap, xen-devel

On 12/06/13 13:38, Ian Campbell wrote:
> These leaks aren't serious, since they are only in xl but this makes "xl list"
> clean according to valgrind, which is useful from the point of view of
> eliminating false positives when looking at the state of libxl (where leaks
> matter).
>
> Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
> Cc: George.Dunlap@citrix.com

Risk of introducing bugs? Almost nil.
Makes xen 4.3 more awesome?  Yes, by allowing valgrind to run cleanly.

Re the release:

Acked-by: George Dunlap <george.dunlap@eu.citrix.com>

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] xl: free default_{vifscript, bridge, gatewaydev} on exit
  2013-06-12 13:19 ` George Dunlap
@ 2013-06-27  8:50   ` Ian Campbell
  0 siblings, 0 replies; 5+ messages in thread
From: Ian Campbell @ 2013-06-27  8:50 UTC (permalink / raw)
  To: George Dunlap; +Cc: ian.jackson, George.Dunlap, xen-devel

On Wed, 2013-06-12 at 14:19 +0100, George Dunlap wrote:
> On 12/06/13 13:38, Ian Campbell wrote:
> > These leaks aren't serious, since they are only in xl but this makes "xl list"
> > clean according to valgrind, which is useful from the point of view of
> > eliminating false positives when looking at the state of libxl (where leaks
> > matter).
> >
> > Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
> > Cc: George.Dunlap@citrix.com
> 
> Risk of introducing bugs? Almost nil.
> Makes xen 4.3 more awesome?  Yes, by allowing valgrind to run cleanly.
> 
> Re the release:
> 
> Acked-by: George Dunlap <george.dunlap@eu.citrix.com>

Uh, seems these have languished in my queue since then, since more than
two weeks have passed I don't want to just carry that ack over. I think
it is now too late?

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2013-06-27  8:50 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-06-12 12:38 [PATCH] xl: free default_{vifscript, bridge, gatewaydev} on exit Ian Campbell
2013-06-12 12:41 ` Ian Jackson
2013-06-12 13:08   ` Ian Campbell
2013-06-12 13:19 ` George Dunlap
2013-06-27  8:50   ` Ian Campbell

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.