<p>fixeria has uploaded this change for <strong>review</strong>.</p><p><a href="https://gerrit.osmocom.org/c/osmo-hlr/+/17112">View Change</a></p><pre style="font-family: monospace,monospace; white-space: pre-wrap;">db: fix possible SQLite3 allocated memory leak in db_open()<br><br>From https://sqlite.org/c3ref/exec.html:<br><br>  To avoid memory leaks, the application should invoke sqlite3_free()<br>  on error message strings returned through the 5th parameter of<br>  sqlite3_exec() after the error message string is no longer needed.<br>  If the 5th parameter to sqlite3_exec() is not NULL and no errors<br>  occur, then sqlite3_exec() sets the pointer in its 5th parameter<br>  to NULL before returning.<br><br>Change-Id: Ic9ed9bad3165bc4a637fe963f51e923f012e19ac<br>Fixes: CID#208182<br>---<br>M src/db.c<br>1 file changed, 3 insertions(+), 1 deletion(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">git pull ssh://gerrit.osmocom.org:29418/osmo-hlr refs/changes/12/17112/1</pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;"><span>diff --git a/src/db.c b/src/db.c</span><br><span>index 5e5ad35..9d0c621 100644</span><br><span>--- a/src/db.c</span><br><span>+++ b/src/db.c</span><br><span>@@ -535,9 +535,11 @@</span><br><span> </span><br><span>         char *err_msg;</span><br><span>       rc = sqlite3_exec(dbc->db, "PRAGMA journal_mode=WAL; PRAGMA synchonous = NORMAL;", 0, 0, &err_msg);</span><br><span style="color: hsl(0, 100%, 40%);">-    if (rc != SQLITE_OK)</span><br><span style="color: hsl(120, 100%, 40%);">+  if (rc != SQLITE_OK) {</span><br><span>               LOGP(DDB, LOGL_ERROR, "Unable to set Write-Ahead Logging: %s\n",</span><br><span>                   err_msg);</span><br><span style="color: hsl(120, 100%, 40%);">+             sqlite3_free(err_msg);</span><br><span style="color: hsl(120, 100%, 40%);">+        }</span><br><span> </span><br><span>        version = db_get_user_version(dbc);</span><br><span>  if (version < 0) {</span><br><span></span><br></pre><p>To view, visit <a href="https://gerrit.osmocom.org/c/osmo-hlr/+/17112">change 17112</a>. To unsubscribe, or for help writing mail filters, visit <a href="https://gerrit.osmocom.org/settings">settings</a>.</p><div itemscope itemtype="http://schema.org/EmailMessage"><div itemscope itemprop="action" itemtype="http://schema.org/ViewAction"><link itemprop="url" href="https://gerrit.osmocom.org/c/osmo-hlr/+/17112"/><meta itemprop="name" content="View Change"/></div></div>

<div style="display:none"> Gerrit-Project: osmo-hlr </div>
<div style="display:none"> Gerrit-Branch: master </div>
<div style="display:none"> Gerrit-Change-Id: Ic9ed9bad3165bc4a637fe963f51e923f012e19ac </div>
<div style="display:none"> Gerrit-Change-Number: 17112 </div>
<div style="display:none"> Gerrit-PatchSet: 1 </div>
<div style="display:none"> Gerrit-Owner: fixeria <axilirator@gmail.com> </div>
<div style="display:none"> Gerrit-MessageType: newchange </div>