diff options
author | Christophe Genevey Metat <genevey.christophe@gmail.com> | 2016-06-07 13:50:08 +0000 |
---|---|---|
committer | Christophe Genevey Metat <genevey.christophe@gmail.com> | 2016-06-07 13:50:08 +0000 |
commit | f12ac33d46fad89af94831f16dcdebd436a851da (patch) | |
tree | 0e79ed94a2348be62f8c683421251d69bcc159f3 /src/my/my.c | |
parent | ec817d5981e88f06f9f153cd423d13860fba4b57 (diff) | |
download | gnunet-f12ac33d46fad89af94831f16dcdebd436a851da.tar.gz gnunet-f12ac33d46fad89af94831f16dcdebd436a851da.zip |
written function cleanup
Diffstat (limited to 'src/my/my.c')
-rw-r--r-- | src/my/my.c | 22 |
1 files changed, 22 insertions, 0 deletions
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, | |||
65 | p, | 65 | p, |
66 | &qbind[off])) | 66 | &qbind[off])) |
67 | { | 67 | { |
68 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | ||
69 | "Conversion for MySQL query failed at offset %u\n", | ||
70 | i); | ||
71 | GNUNET_MY_cleanup_query (params); | ||
68 | return GNUNET_SYSERR; | 72 | return GNUNET_SYSERR; |
69 | } | 73 | } |
70 | off += p->num_params; | 74 | off += p->num_params; |
@@ -88,6 +92,7 @@ GNUNET_MY_exec_prepared (struct GNUNET_MYSQL_Context *mc, | |||
88 | "mysql_stmt_execute", __FILE__, __LINE__, | 92 | "mysql_stmt_execute", __FILE__, __LINE__, |
89 | mysql_stmt_error (stmt)); | 93 | mysql_stmt_error (stmt)); |
90 | GNUNET_MYSQL_statements_invalidate (mc); | 94 | GNUNET_MYSQL_statements_invalidate (mc); |
95 | GNUNET_MY_cleanup_query (params); | ||
91 | return GNUNET_SYSERR; | 96 | return GNUNET_SYSERR; |
92 | } | 97 | } |
93 | } | 98 | } |
@@ -97,6 +102,23 @@ GNUNET_MY_exec_prepared (struct GNUNET_MYSQL_Context *mc, | |||
97 | 102 | ||
98 | 103 | ||
99 | /** | 104 | /** |
105 | * Free all memory that was allocated in @a qp during | ||
106 | * #GNUNET_MY_exect_prepared(). | ||
107 | * | ||
108 | * @param qp query specification to clean up | ||
109 | */ | ||
110 | void | ||
111 | GNUNET_MY_cleanup_query (struct GNUNET_MY_QueryParam *qp) | ||
112 | { | ||
113 | unsigned int i; | ||
114 | |||
115 | for (i=0;NULL != qp[i].cleaner;i++) | ||
116 | qp[i].cleaner (qp[i].conv_cls, | ||
117 | &qp[i]); | ||
118 | } | ||
119 | |||
120 | |||
121 | /** | ||
100 | * Extract results from a query result according to the given | 122 | * Extract results from a query result according to the given |
101 | * specification. Always fetches the next row. | 123 | * specification. Always fetches the next row. |
102 | * | 124 | * |