aboutsummaryrefslogtreecommitdiff
path: root/src/my/my.c
diff options
context:
space:
mode:
authorChristophe Genevey Metat <genevey.christophe@gmail.com>2016-06-10 12:32:40 +0000
committerChristophe Genevey Metat <genevey.christophe@gmail.com>2016-06-10 12:32:40 +0000
commitf06baa8a2c99545167142049f19f4a7bedfe1764 (patch)
tree185d0bba4ddd80c6c186183bc1cdf8d85815023c /src/my/my.c
parent2f1634060e7d4aab5ff046ca50f1e21bae7471fb (diff)
downloadgnunet-f06baa8a2c99545167142049f19f4a7bedfe1764.tar.gz
gnunet-f06baa8a2c99545167142049f19f4a7bedfe1764.zip
finish to fix memory leak
Diffstat (limited to 'src/my/my.c')
-rw-r--r--src/my/my.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/src/my/my.c b/src/my/my.c
index 0328477be..54b1b8e64 100644
--- a/src/my/my.c
+++ b/src/my/my.c
@@ -107,6 +107,7 @@ GNUNET_MY_exec_prepared (struct GNUNET_MYSQL_Context *mc,
107 * #GNUNET_MY_exect_prepared(). 107 * #GNUNET_MY_exect_prepared().
108 * 108 *
109 * @param qp query specification to clean up 109 * @param qp query specification to clean up
110 * @param qbind array of parameter to clean up
110 */ 111 */
111void 112void
112GNUNET_MY_cleanup_query (struct GNUNET_MY_QueryParam *qp, 113GNUNET_MY_cleanup_query (struct GNUNET_MY_QueryParam *qp,
@@ -115,9 +116,9 @@ GNUNET_MY_cleanup_query (struct GNUNET_MY_QueryParam *qp,
115 unsigned int i; 116 unsigned int i;
116 117
117 for (i=0; NULL != qp[i].conv ;i++) 118 for (i=0; NULL != qp[i].conv ;i++)
118 if(NULL != qp[i].cleaner) 119 if(NULL != qp[i].cleaner)
119 qp[i].cleaner (qp[i].conv_cls, 120 qp[i].cleaner (qp[i].conv_cls,
120 &qbind[i]); 121 &qbind[i]);
121} 122}
122 123
123 124
@@ -142,7 +143,7 @@ GNUNET_MY_extract_result (struct GNUNET_MYSQL_StatementHandle *sh,
142 int ret; 143 int ret;
143 MYSQL_STMT *stmt; 144 MYSQL_STMT *stmt;
144 145
145 stmt = GNUNET_MYSQL_statement_get_stmt (NULL /* FIXME */, sh); 146 stmt = GNUNET_MYSQL_statement_get_stmt (NULL, sh);
146 if (NULL == stmt) 147 if (NULL == stmt)
147 { 148 {
148 GNUNET_log_from (GNUNET_ERROR_TYPE_ERROR, "mysql", 149 GNUNET_log_from (GNUNET_ERROR_TYPE_ERROR, "mysql",
@@ -183,7 +184,6 @@ GNUNET_MY_extract_result (struct GNUNET_MYSQL_StatementHandle *sh,
183 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, 184 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
184 "Pre-conversion for MySQL result failed at offset %u\n", 185 "Pre-conversion for MySQL result failed at offset %u\n",
185 i); 186 i);
186 GNUNET_MY_cleanup_result (rs);
187 return GNUNET_SYSERR; 187 return GNUNET_SYSERR;
188 } 188 }
189 field_off += rp->num_fields; 189 field_off += rp->num_fields;
@@ -209,6 +209,7 @@ GNUNET_MY_extract_result (struct GNUNET_MYSQL_StatementHandle *sh,
209 _("mysql_stmt_fetch failed at %s:%d with error: %s\n"), 209 _("mysql_stmt_fetch failed at %s:%d with error: %s\n"),
210 __FILE__, __LINE__, 210 __FILE__, __LINE__,
211 mysql_stmt_error (stmt)); 211 mysql_stmt_error (stmt));
212 GNUNET_MY_cleanup_result (rs);
212 return GNUNET_SYSERR; 213 return GNUNET_SYSERR;
213 } 214 }
214 field_off = 0; 215 field_off = 0;
@@ -241,7 +242,7 @@ GNUNET_MY_extract_result (struct GNUNET_MYSQL_StatementHandle *sh,
241 * Free all memory that was allocated in @a rs during 242 * Free all memory that was allocated in @a rs during
242 * #GNUNET_MY_extract_result(). 243 * #GNUNET_MY_extract_result().
243 * 244 *
244 * @param rs reult specification to clean up 245 * @param rs result specification to clean up
245 */ 246 */
246void 247void
247GNUNET_MY_cleanup_result (struct GNUNET_MY_ResultSpec *rs) 248GNUNET_MY_cleanup_result (struct GNUNET_MY_ResultSpec *rs)