<div class="gmail_quote">On Sun, Oct 2, 2011 at 04:46, Dominik Szczerba <span dir="ltr">&lt;<a href="mailto:dominik@itis.ethz.ch">dominik@itis.ethz.ch</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<div id=":3no">if(object)<br>
   KSP/Mat/Vec/etcDestroy(object)</div></blockquote></div><br><div>Just call KSPDestroy(&amp;ksp);</div><div><br></div><div>It doesn&#39;t matter if KSP is NULL or a valid object because this function checks. But note that if you just write</div>
<div><br></div><div>KSP ksp;</div><div><br></div><div>or allocate similarly in part of malloc() --- with no memzero() or similar --- then the value of ksp is undefined.</div>