xl: free default_{vifscript, bridge, gatewaydev} on exit
PATCH 1/1 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).
---
I'm inclined to suggest that these are 4.4 material.
--- tools/libxl/xl.c | 15 +++++++++++++++ 1 files changed, 15 insertions(+), 0 deletions(-)
tools/libxl/xl.c +15 -0
@@ -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)
Signature · 1 line
1.7.2.5
Ian Campbell writes ("[PATCH] xl: free default_{vifscript,bridge,gatewaydev} on exit"):
Quoted 4 lines
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).
...
tools/libxl/xl.c static void xl_ctx_free(void) · line 282
Quoted 3 lines
tools/libxl/xl.c +3
-0+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.
Quoted 18 lines · Ian Jackson
Ian Campbell writes ("[PATCH] xl: free default_{vifscript,bridge,gatewaydev} on exit"):
Quoted 4 lines
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).
...
tools/libxl/xl.c static void xl_ctx_free(void) · line 282
Quoted 3 lines
tools/libxl/xl.c +3
-0+if (default_vifscript) { +free (default_vifscript); + default_vifscript =NULL ;These ifs are unnecessary. free(NULL) is a no-op.
I would write:
(quoted diff) +3
-0+ free(default_vifscript); default_vifscript = NULL; + free(default_bridge); default_bridge = NULL; + free(default_gatewaydev); default_gatewaydev = NULL;
Quoted 1 line
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.
Quoted 7 lines · Ian Campbell
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 <[email protected]>
Risk of introducing bugs? Almost nil.
Makes xen 4.3 more awesome? Yes, by allowing valgrind to run cleanly.
Re the release:
Quoted 9 lines · George Dunlap
Quoted 7 lines · Ian Campbell
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 <[email protected]>
Quoted 6 lines
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 <[email protected]>
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?