aboutsummaryrefslogtreecommitdiff
path: root/src/my/my.c
diff options
context:
space:
mode:
authorChristophe Genevey Metat <genevey.christophe@gmail.com>2016-06-07 13:50:08 +0000
committerChristophe Genevey Metat <genevey.christophe@gmail.com>2016-06-07 13:50:08 +0000
commitf12ac33d46fad89af94831f16dcdebd436a851da (patch)
tree0e79ed94a2348be62f8c683421251d69bcc159f3 /src/my/my.c
parentec817d5981e88f06f9f153cd423d13860fba4b57 (diff)
written function cleanup
Diffstat (limited to 'src/my/my.c')
-rw-r--r--src/my/my.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/src/my/my.c b/src/my/my.c
index 5409166fb9..cec22716f0 100644
--- a/src/my/my.c
+++ b/src/my/my.c
@@ -65,6 +65,10 @@ GNUNET_MY_exec_prepared (struct GNUNET_MYSQL_Context *mc,
p,
&qbind[off]))
{
+ GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+ "Conversion for MySQL query failed at offset %u\n",
+ i);
+ GNUNET_MY_cleanup_query (params);
return GNUNET_SYSERR;
}
off += p->num_params;
@@ -88,6 +92,7 @@ GNUNET_MY_exec_prepared (struct GNUNET_MYSQL_Context *mc,
"mysql_stmt_execute", __FILE__, __LINE__,
mysql_stmt_error (stmt));
GNUNET_MYSQL_statements_invalidate (mc);
+ GNUNET_MY_cleanup_query (params);
return GNUNET_SYSERR;
}
}
@@ -97,6 +102,23 @@ GNUNET_MY_exec_prepared (struct GNUNET_MYSQL_Context *mc,
/**
+ * Free all memory that was allocated in @a qp during
+ * #GNUNET_MY_exect_prepared().
+ *
+ * @param qp query specification to clean up
+ */
+void
+GNUNET_MY_cleanup_query (struct GNUNET_MY_QueryParam *qp)
+{
+ unsigned int i;
+
+ for (i=0;NULL != qp[i].cleaner;i++)
+ qp[i].cleaner (qp[i].conv_cls,
+ &qp[i]);
+}
+
+
+/**
* Extract results from a query result according to the given
* specification. Always fetches the next row.
*