* [PATCH]libxc: fix a Segmentation fault
@ 2010-06-28 6:45 Yang Hongyang
2010-06-28 15:54 ` Ian Jackson
0 siblings, 1 reply; 3+ messages in thread
From: Yang Hongyang @ 2010-06-28 6:45 UTC (permalink / raw)
To: xen-devel@lists.xensource.com
# xl list
xc: error: Could not obtain handle on privileged command interface (2 = No such file or directory): Internal error
Segmentation fault
This is because xc free the logger which xl created.
Signed-off-by: Yang Hongyang <yanghy@cn.fujitsu.com>
diff -r b622e411eef8 tools/libxc/xc_private.c
--- a/tools/libxc/xc_private.c Thu Jun 24 21:56:03 2010 +0100
+++ b/tools/libxc/xc_private.c Mon Jun 28 22:48:07 2010 +0800
@@ -19,6 +19,7 @@
xentoollog_logger *dombuild_logger,
unsigned open_flags) {
xc_interface xch_buf, *xch = &xch_buf;
+ int init_handler = 0;
xch->fd = -1;
xch->dombuild_logger_file = 0;
@@ -33,6 +34,7 @@
xtl_createlogger_stdiostream(stderr, XTL_PROGRESS, 0);
if (!xch->error_handler)
goto err;
+ init_handler =1;
}
xch = malloc(sizeof(*xch));
@@ -52,7 +54,7 @@
return xch;
err:
- if (xch) xtl_logger_destroy(xch->error_handler);
+ if (xch && init_handler) xtl_logger_destroy(xch->error_handler);
if (xch != &xch_buf) free(xch);
return 0;
}
--
Regards
Yang Hongyang
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [PATCH]libxc: fix a Segmentation fault
2010-06-28 6:45 [PATCH]libxc: fix a Segmentation fault Yang Hongyang
@ 2010-06-28 15:54 ` Ian Jackson
2010-06-29 0:40 ` Yang Hongyang
0 siblings, 1 reply; 3+ messages in thread
From: Ian Jackson @ 2010-06-28 15:54 UTC (permalink / raw)
To: Yang Hongyang; +Cc: xen-devel@lists.xensource.com
Yang Hongyang writes ("[Xen-devel] [PATCH]libxc: fix a Segmentation fault"):
> # xl list
> xc: error: Could not obtain handle on privileged command interface (2 = No such file or directory): Internal error
> Segmentation fault
>
> This is because xc free the logger which xl created.
Well spotted. You're right about the cause, but your fix is not
correct. The correct fix is that xc_interface_open's error path
should free error_handler_tofree rather than error_handler. So there
is no need to add another variable. I will apply that fix.
Thanks,
Ian.
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [PATCH]libxc: fix a Segmentation fault
2010-06-28 15:54 ` Ian Jackson
@ 2010-06-29 0:40 ` Yang Hongyang
0 siblings, 0 replies; 3+ messages in thread
From: Yang Hongyang @ 2010-06-29 0:40 UTC (permalink / raw)
To: Ian Jackson; +Cc: xen-devel@lists.xensource.com
On 06/28/2010 11:54 PM, Ian Jackson wrote:
> Yang Hongyang writes ("[Xen-devel] [PATCH]libxc: fix a Segmentation fault"):
>> # xl list
>> xc: error: Could not obtain handle on privileged command interface (2 = No such file or directory): Internal error
>> Segmentation fault
>>
>> This is because xc free the logger which xl created.
>
> Well spotted. You're right about the cause, but your fix is not
> correct. The correct fix is that xc_interface_open's error path
> should free error_handler_tofree rather than error_handler. So there
> is no need to add another variable. I will apply that fix.
>
OK,Thanks Ian.
> Thanks,
> Ian.
>
>
--
Regards
Yang Hongyang
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2010-06-29 0:40 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-06-28 6:45 [PATCH]libxc: fix a Segmentation fault Yang Hongyang
2010-06-28 15:54 ` Ian Jackson
2010-06-29 0:40 ` Yang Hongyang
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.