<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Aug 1, 2018 at 10:27 AM, Marcos Paulo de Souza <span dir="ltr"><<a href="mailto:marcos.souza.org@gmail.com" target="_blank">marcos.souza.org@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">esxVI_AutoStartPowerInfo_Free, which is called from<br>
esxVI_HostAutoStartManagerConf<wbr>ig_Free, will always call VIR_FREE to free<br>
memory from {start,stop}Action, leading to a invalid pointer.<br>
<br>
With this patch applied, ESX can set autostart successfully to all it's<br>
domains.<br>
<br>
Signed-off-by: Marcos Paulo de Souza <<a href="mailto:marcos.souza.org@gmail.com" target="_blank">marcos.souza.org@gmail.com</a>><br>
---<br>
 src/esx/esx_driver.c | 8 +++++---<br>
 1 file changed, 5 insertions(+), 3 deletions(-)<br>
<br>
diff --git a/src/esx/esx_driver.c b/src/esx/esx_driver.c<br>
index 3835e4cb3c..a49862a1de 100644<br>
--- a/src/esx/esx_driver.c<br>
+++ b/src/esx/esx_driver.c<br>
@@ -3386,7 +3386,9 @@ esxDomainSetAutostart(virDomai<wbr>nPtr domain, int autostart)<br>
     if (esxVI_AutoStartPowerInfo_Allo<wbr>c(&newPowerInfo) < 0 ||<br>
         esxVI_Int_Alloc(&<wbr>newPowerInfo->startOrder) < 0 ||<br>
         esxVI_Int_Alloc(&<wbr>newPowerInfo->startDelay) < 0 ||<br>
-        esxVI_Int_Alloc(&newPowerInfo-<wbr>>stopDelay) < 0) {<br>
+        esxVI_Int_Alloc(&newPowerInfo-<wbr>>stopDelay) < 0 ||<br>
+        VIR_ALLOC_N(newPowerInfo->star<wbr>tAction, 8) < 0 ||<br>
+        VIR_ALLOC_N(newPowerInfo->stop<wbr>Action, 5) < 0) {<br>
         goto cleanup;<br>
     }<br>
<br>
@@ -3394,9 +3396,9 @@ esxDomainSetAutostart(virDomai<wbr>nPtr domain, int autostart)<br>
     newPowerInfo->startOrder->val<wbr>ue = -1; /* no specific start order */<br>
     newPowerInfo->startDelay->val<wbr>ue = -1; /* use system default */<br>
     newPowerInfo-><wbr>waitForHeartbeat = esxVI_AutoStartWaitHeartbeatSe<wbr>tting_SystemDefault;<br>
-    newPowerInfo->startAction = autostart ? (char *)"powerOn" : (char *)"none";<br>
+    strcpy(newPowerInfo->startActi<wbr>on, autostart ? (char *)"powerOn" : (char *)"none");<br></blockquote><div>Please use virStrcpyStatic, seeing <a href="https://libvirt.org/hacking.html#string_copying" target="_blank">https://libvirt.org/hacking.<wbr>html#string_copying</a> <br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
     newPowerInfo->stopDelay-><wbr>value = -1; /* use system default */<br>
-    newPowerInfo->stopAction = (char *)"none";<br>
+    strcpy(newPowerInfo->stopActio<wbr>n, (char *)"none");<br>
<br></blockquote><div>The same here <br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
     if (esxVI_AutoStartPowerInfo_Appe<wbr>ndToList(&spec->powerInfo,<br>
                                               newPowerInfo) < 0) {<br>
<span class="m_8407365858451645090gmail-HOEnZb"><font color="#888888">-- <br>
2.17.1<br>
<br>
--<br>
libvir-list mailing list<br>
<a href="mailto:libvir-list@redhat.com" target="_blank">libvir-list@redhat.com</a><br>
<a href="https://www.redhat.com/mailman/listinfo/libvir-list" rel="noreferrer" target="_blank">https://www.redhat.com/mailman<wbr>/listinfo/libvir-list</a><br>
</font></span></blockquote></div><br><br clear="all"><br>-- <br><div class="m_8407365858451645090gmail_signature"><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr">Best regards,</div><div dir="ltr">------------------------------<wbr>-----<br></div><div dir="ltr">Han Han<br>Quality Engineer<br>Redhat.<br><br>Email: <a href="mailto:hhan@redhat.com" target="_blank">hhan@redhat.com</a><br>Phone: +861065339333<br></div></div></div></div></div></div>
</div></div>