From f12ac33d46fad89af94831f16dcdebd436a851da Mon Sep 17 00:00:00 2001 From: Christophe Genevey Metat Date: Tue, 7 Jun 2016 13:50:08 +0000 Subject: written function cleanup --- src/my/my.c | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'src/my/my.c') diff --git a/src/my/my.c b/src/my/my.c index 5409166fb..cec22716f 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; } } @@ -96,6 +101,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. -- cgit v1.2.3