<html><body>
<p>The stack trace is as follows:<br>
<br>
Program received signal SIGABRT, Aborted.<br>
0x00000035ad830265 in raise () from /lib64/libc.so.6<br>
(gdb) bt<br>
#0  0x00000035ad830265 in raise () from /lib64/libc.so.6<br>
#1  0x00000035ad831d10 in abort () from /lib64/libc.so.6<br>
#2  0x00000035ad86a84b in __libc_message () from /lib64/libc.so.6<br>
#3  0x00000035ad8722ef in _int_free () from /lib64/libc.so.6<br>
#4  0x00000035ad87273b in free () from /lib64/libc.so.6<br>
#5  0x0000000000406771 in vshDeinit (ctl=0x7fffd35d35e0) at virsh.c:8244<br>
#6  0x00000000004069a5 in vshError (ctl=0x7fffd35d35e0, doexit=<value optimized out>, format=0x414f66 "%s") at virsh.c:7861<br>
#7  0x00000000004067c4 in vshDeinit (ctl=0x7fffd35d35e0) at virsh.c:8248<br>
#8  0x000000000041335e in main (argc=3, argv=0x7fffd35d3748) at virsh.c:8493<br>
<br>
I am trying to run libvirt-0.7.1-0.1.git3ef2e05.fc12.src.rpm on RHEL5.4.<br>
<br>
vshDeinit gets called twice, so ctl->name is freed twice.<br>
<br>
How about this patch then?<br>
<br>
<i>(See attached file: 0001-Fix-possible-double-free.patch)</i><br>
<br>
-- <br>
Mark<br>
<br>
You must be the change you wish to see in the world. -- Mahatma Gandhi<br>
Worrying is praying for that you do not wish to happen.<br>
<img width="16" height="16" src="cid:2__=09BBFCA8DFCB86978f9e8a93df938@us.ibm.com" border="0" alt="Inactive hide details for Chris Lalancette <clalance@redhat.com>">Chris Lalancette <clalance@redhat.com><br>
<br>
<br>

<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr valign="top"><td style="background-image:url(cid:3__=09BBFCA8DFCB86978f9e8a93df938@us.ibm.com); background-repeat: no-repeat; " width="40%">
<ul>
<ul>
<ul>
<ul><b><font size="2">Chris Lalancette <clalance@redhat.com></font></b><font size="2"> </font>
<p><font size="2">09/16/2009 06:30 AM</font></ul>
</ul>
</ul>
</ul>
</td><td width="60%">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr valign="top"><td width="1%"><img width="58" height="1" src="cid:4__=09BBFCA8DFCB86978f9e8a93df938@us.ibm.com" border="0" alt=""><br>
<div align="right"><font size="2">To</font></div></td><td width="100%"><img width="1" height="1" src="cid:4__=09BBFCA8DFCB86978f9e8a93df938@us.ibm.com" border="0" alt=""><br>
<font size="2">Mark Hamzy/Austin/IBM@IBMUS</font></td></tr>

<tr valign="top"><td width="1%"><img width="58" height="1" src="cid:4__=09BBFCA8DFCB86978f9e8a93df938@us.ibm.com" border="0" alt=""><br>
<div align="right"><font size="2">cc</font></div></td><td width="100%"><img width="1" height="1" src="cid:4__=09BBFCA8DFCB86978f9e8a93df938@us.ibm.com" border="0" alt=""><br>
<font size="2">libvir-list@redhat.com</font></td></tr>

<tr valign="top"><td width="1%"><img width="58" height="1" src="cid:4__=09BBFCA8DFCB86978f9e8a93df938@us.ibm.com" border="0" alt=""><br>
<div align="right"><font size="2">Subject</font></div></td><td width="100%"><img width="1" height="1" src="cid:4__=09BBFCA8DFCB86978f9e8a93df938@us.ibm.com" border="0" alt=""><br>
<font size="2">Re: [libvirt] PATCH] Stop double free</font></td></tr>
</table>

<table border="0" cellspacing="0" cellpadding="0">
<tr valign="top"><td width="58"><img width="1" height="1" src="cid:4__=09BBFCA8DFCB86978f9e8a93df938@us.ibm.com" border="0" alt=""></td><td width="336"><img width="1" height="1" src="cid:4__=09BBFCA8DFCB86978f9e8a93df938@us.ibm.com" border="0" alt=""></td></tr>
</table>
</td></tr>
</table>
<br>
<tt>Mark Hamzy wrote:<br>
> diff --git a/src/virsh.c b/src/virsh.c<br>
> index 4825f1c..5fc6c8f 100644<br>
> --- a/src/virsh.c<br>
> +++ b/src/virsh.c<br>
> @@ -8201,7 +8201,7 @@ vshError(vshControl *ctl, int doexit, const char<br>
> *format, ...)<br>
> fputc('\n', stderr);<br>
> <br>
> if (doexit) {<br>
> - if (ctl)<br>
> + if (ctl && ctl->conn)<br>
> vshDeinit(ctl);<br>
> exit(EXIT_FAILURE);<br>
> }<br>
<br>
I don't think this patch is right.  vshDeinit() already has a check for<br>
ctl->conn, and if you put it higher up in the call chain like this, you'll leak<br>
the ctl->name memory and the ctrl->log_fd file descriptors.  Do you have a stack<br>
trace with line numbers in it (i.e. debugging information)?  Also, what version<br>
of libvirt are you using?  That might shed a bit more light on what the problem is.<br>
<br>
-- <br>
Chris Lalancette<br>
</tt><br>
</body></html>