<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
<div class="moz-cite-prefix">Op 06-08-13 14:20, Iulian Stana
schreef:<br>
</div>
<blockquote
cite="mid:CAABE7Mgc4wstxWQodDQLy3YJu-qZvo_1EQMjGg7Zj1kbxmL-yg@mail.gmail.com"
type="cite">
<div dir="ltr">
<div class="gmail_extra">
<div class="gmail_quote"><br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px
0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
<div>> +<br>
> +/*<br>
> + * Close the connection for the given handle.<br>
> + * Erase the handle and free the memory<br>
> + * \param handle The handle of the connection that
I want to close<br>
> + * \return 0 if successful<br>
> + * -1 to indicate an error, with errno
set appropriately.<br>
> + * errno can be:<br>
> + * EINVAL<br>
> + * */<br>
> +int hg_close(hg_handle **handle);<br>
<br>
</div>
One '*' too many, unless you're planning on closing
multiple handles at once...<br>
</blockquote>
<div><br>
</div>
<div>It's a defense action, I need to set the pointer to
NULL, to be sure that there will</div>
<div>be no other calls after hg_close. (We can assume that
our users will not make </div>
<div>this kind of action, then I will change to only one
'*')</div>
</div>
</div>
</div>
</blockquote>
<br>
That does not help if the handle is also in another variable (e.g.
of a calling function).<br>
<br>
I do think it’s smart to defend against this, but it’s better
prevented by always handing out unique handles that will cause an
error if reused after closing.<br>
<br>
~Laurens<br>
<br>
</body>
</html>