<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css" style="display:none;"><!-- P {margin-top:0;margin-bottom:0;} --></style>
</head>
<body dir="ltr">
<div id="divtagdefaultwrapper" style="font-size:12pt;color:#000000;background-color:#FFFFFF;font-family:Calibri,Arial,Helvetica,sans-serif;">
<p>Hi.</p>
<p><br>
</p>
<p>I'm using a release of OpenSIPS 2.1 from 2015.<br>
</p>
<p><br>
</p>
<p>When I use avp_db_query to execute SQL Select, everything is ok.</p>
<p>However if I use avp_db_query to execute, let's say, a SQL Update, there is a misinterpretation of a parameter in db_sqlite_free.</p>
<p><br>
</p>
<p>The parameter _r will be null and the original function db_sqlite_free interprets it as an invalid parameter. But it is not. For SQL Updates, the result (_r) will be null. It is not an error.</p>
<p>So, there is no need to log 'invalid parameter value' message. In this case, I have changed the beginning of the function db_sqlite_free as you can see:<br>
</p>
<p><br>
</p>
<p><br>
</p>
<p>/**<br>
* Release a result set from memory.<br>
* \param _h handle to the database<br>
* \param _r result set that should be freed<br>
* \return zero on success, negative value on failure<br>
*/<br>
int db_sqlite_free_result(db_con_t* _h, db_res_t* _r)<br>
{<br>
int i;<br>
int j;<br>
db_val_t* v;<br>
db_row_t* res_col;<br>
<br>
if (!_h) {<br>
LM_ERR("invalid parameter value\n");<br>
return -1;<br>
}<br>
if (!_r){<br>
return 0; //Returns zero because it is not a problem when this parameter is null, for example.<br>
}</p>
<p>.</p>
<p>.</p>
<p>.</p>
<p><br>
</p>
<p>Does it make sense?</p>
<p><br>
</p>
<p>Regards.<br>
</p>
<p><br>
</p>
<p><br>
</p>
<p><br>
</p>
<div id="Signature">
<div name="divtagdefaultwrapper" style="font-family:Calibri,Arial,Helvetica,sans-serif; font-size:; margin:0">
<div class="BodyFragment"><font size="2">
<div class="PlainText">RODRIGO PIMENTA CARVALHO<br>
Inatel Competence Center<br>
Software<br>
Ph: +55 35 3471 9200 RAMAL 979<br>
</div>
</font></div>
</div>
</div>
</div>
</body>
</html>