aboutsummaryrefslogtreecommitdiff
path: root/src/my/my_result_helper.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_result_helper.c
parent2f1634060e7d4aab5ff046ca50f1e21bae7471fb (diff)
downloadgnunet-f06baa8a2c99545167142049f19f4a7bedfe1764.tar.gz
gnunet-f06baa8a2c99545167142049f19f4a7bedfe1764.zip
finish to fix memory leak
Diffstat (limited to 'src/my/my_result_helper.c')
-rw-r--r--src/my/my_result_helper.c148
1 files changed, 72 insertions, 76 deletions
diff --git a/src/my/my_result_helper.c b/src/my/my_result_helper.c
index 9c04b9bed..963e3f618 100644
--- a/src/my/my_result_helper.c
+++ b/src/my/my_result_helper.c
@@ -23,12 +23,15 @@
23#include "gnunet_util_lib.h" 23#include "gnunet_util_lib.h"
24#include "gnunet_my_lib.h" 24#include "gnunet_my_lib.h"
25 25
26
26/** 27/**
27 * extract data from a Mysql database @a result at row @a row 28 * extract data from a Mysql database @a result at row @a row
28 * 29 *
29 * @param cls closure 30 * @param cls closure
30 * @param qp data about the query 31 * @param[in,out] rs
31 * @param result mysql result 32 * @param stmt the mysql statement that is being run
33 * @param column the column that is being processed
34 * @param[out] result mysql result
32 * @return 35 * @return
33 * #GNUNET_OK if all results could be extracted 36 * #GNUNET_OK if all results could be extracted
34 * #GNUNET_SYSERR if a result was invalid 37 * #GNUNET_SYSERR if a result was invalid
@@ -117,11 +120,12 @@ cleanup_varsize_blob (void *cls,
117 } 120 }
118} 121}
119 122
123
120/** 124/**
121 * Variable-size result expected 125 * Variable-size result expected
122 * 126 *
123 * @param[out] dst where to store the result, allocated 127 * @param[out] dst where to store the result, allocated
124 * @param[out] sptr where to store the size of @a dst 128 * @param[out] ptr_size where to store the size of @a dst
125 * @return array entru for the result specification to use 129 * @return array entru for the result specification to use
126 */ 130 */
127struct GNUNET_MY_ResultSpec 131struct GNUNET_MY_ResultSpec
@@ -146,11 +150,10 @@ GNUNET_MY_result_spec_variable_size (void **dst,
146 * Extract data from a Mysql database @a result at row @a row 150 * Extract data from a Mysql database @a result at row @a row
147 * 151 *
148 * @param cls closure 152 * @param cls closure
149 * @param result where to extract data from 153 * @param[in,out] rs
150 * @param int row to extract data from 154 * @param stmt the mysql statement that is being run
151 * @param fname name (or prefix) of the fields to extract from 155 * @param column the column that is being processed
152 * @param[in] dst_size desired size, never NULL 156 * @param[out] results
153 * @param[out] dst where to store the result
154 * @return 157 * @return
155 * #GNUNET_OK if all results could be extracted 158 * #GNUNET_OK if all results could be extracted
156 * #GNUNET_SYSERR if a result was invalid(non-existing field or NULL) 159 * #GNUNET_SYSERR if a result was invalid(non-existing field or NULL)
@@ -176,11 +179,10 @@ pre_extract_fixed_blob (void *cls,
176 * result at row @a row 179 * result at row @a row
177 * 180 *
178 * @param cls closure 181 * @param cls closure
179 * @param result where to extract data from 182 * @param[in,out] rs
180 * @param int row to extract data from 183 * @param stmt the mysql statement that is being run
181 * @param fname name (or prefix) of the fields to extract from 184 * @param column the column that is being processed
182 * @param[in] dst_size desired size, never NULL 185 * @param[out] results
183 * @param[out] dst where to store the result
184 * @return 186 * @return
185 * #GNUNET_OK if all results could be extracted 187 * #GNUNET_OK if all results could be extracted
186 * #GNUNET_SYSERR if a result was invalid(non-existing field or NULL) 188 * #GNUNET_SYSERR if a result was invalid(non-existing field or NULL)
@@ -203,7 +205,7 @@ post_extract_fixed_blob (void *cls,
203 * 205 *
204 * @param name name of the field in the table 206 * @param name name of the field in the table
205 * @param[out] dst where to store the result 207 * @param[out] dst where to store the result
206 * @param dst_size number of bytes in @a dst 208 * @param ptr_size number of bytes in @a dst
207 * @return array entry for the result specification to use 209 * @return array entry for the result specification to use
208 */ 210 */
209struct GNUNET_MY_ResultSpec 211struct GNUNET_MY_ResultSpec
@@ -228,11 +230,10 @@ GNUNET_MY_result_spec_fixed_size (void *ptr,
228 * Extract data from a Mysql database @a result at row @a row 230 * Extract data from a Mysql database @a result at row @a row
229 * 231 *
230 * @param cls closure 232 * @param cls closure
231 * @param result where to extract data from 233 * @param[in,out] rs
232 * @param int row to extract data from 234 * @param stmt the mysql statement that is being run
233 * @param fname name (or prefix) of the fields to extract from 235 * @param column the column that is being processed
234 * @param[in, out] dst_size where to store size of result, may be NULL 236 * @param[out] results
235 * @param[out] dst where to store the result
236 * @return 237 * @return
237 * #GNUNET_OK if all results could be extracted 238 * #GNUNET_OK if all results could be extracted
238 * #GNUNET_SYSERR if a result was invalid (non-existing field or NULL) 239 * #GNUNET_SYSERR if a result was invalid (non-existing field or NULL)
@@ -258,11 +259,10 @@ pre_extract_rsa_public_key (void *cls,
258 * result at row @a row 259 * result at row @a row
259 * 260 *
260 * @param cls closure 261 * @param cls closure
261 * @param result where to extract data from 262 * @param[in,out] rs
262 * @param int row to extract data from 263 * @param stmt the mysql statement that is being run
263 * @param fname name (or prefix) of the fields to extract from 264 * @param column the column that is being processed
264 * @param[in, out] dst_size where to store size of result, may be NULL 265 * @param[out] results
265 * @param[out] dst where to store the result
266 * @return 266 * @return
267 * #GNUNET_OK if all results could be extracted 267 * #GNUNET_OK if all results could be extracted
268 * #GNUNET_SYSERR if a result was invalid (non-existing field or NULL) 268 * #GNUNET_SYSERR if a result was invalid (non-existing field or NULL)
@@ -297,6 +297,7 @@ post_extract_rsa_public_key (void *cls,
297 GNUNET_free (buf); 297 GNUNET_free (buf);
298 return GNUNET_SYSERR; 298 return GNUNET_SYSERR;
299 } 299 }
300
300 *pk = GNUNET_CRYPTO_rsa_public_key_decode (buf, 301 *pk = GNUNET_CRYPTO_rsa_public_key_decode (buf,
301 size); 302 size);
302 GNUNET_free (buf); 303 GNUNET_free (buf);
@@ -316,7 +317,7 @@ post_extract_rsa_public_key (void *cls,
316 * by a #GNUNET_MY_ResultConverter. 317 * by a #GNUNET_MY_ResultConverter.
317 * 318 *
318 * @param cls closure 319 * @param cls closure
319 * @param rd result data to clean up 320 * @param rs result data to clean up
320 */ 321 */
321static void 322static void
322clean_rsa_public_key (void *cls, 323clean_rsa_public_key (void *cls,
@@ -354,15 +355,15 @@ GNUNET_MY_result_spec_rsa_public_key (struct GNUNET_CRYPTO_RsaPublicKey **rsa)
354 return res; 355 return res;
355} 356}
356 357
358
357/** 359/**
358 * Extract data from a Mysql database @a result at row @a row. 360 * Extract data from a Mysql database @a result at row @a row.
359 * 361 *
360 * @param cls closure 362 * @param cls closure
361 * @param result where to extract data from 363 * @param[in,out] rs
362 * @param int row to extract data from 364 * @param stmt the mysql statement that is being run
363 * @param fname name (or prefix) of the fields to extract from 365 * @param column the column that is being processed
364 * @param[in,out] dst_size where to store size of result, may be NULL 366 * @param[out] results
365 * @param[out] dst where to store the result
366 * @return 367 * @return
367 * #GNUNET_OK if all results could be extracted 368 * #GNUNET_OK if all results could be extracted
368 * #GNUNET_SYSERR if a result was invalid (non-existing field or NULL) 369 * #GNUNET_SYSERR if a result was invalid (non-existing field or NULL)
@@ -387,11 +388,10 @@ pre_extract_rsa_signature (void *cls,
387 * Extract data from a Mysql database @a result at row @a row. 388 * Extract data from a Mysql database @a result at row @a row.
388 * 389 *
389 * @param cls closure 390 * @param cls closure
390 * @param result where to extract data from 391 * @param[in,out] rs
391 * @param int row to extract data from 392 * @param stmt the mysql statement that is being run
392 * @param fname name (or prefix) of the fields to extract from 393 * @param column the column that is being processed
393 * @param[in,out] dst_size where to store size of result, may be NULL 394 * @param[out] results
394 * @param[out] dst where to store the result
395 * @return 395 * @return
396 * #GNUNET_OK if all results could be extracted 396 * #GNUNET_OK if all results could be extracted
397 * #GNUNET_SYSERR if a result was invalid (non-existing field or NULL) 397 * #GNUNET_SYSERR if a result was invalid (non-existing field or NULL)
@@ -481,15 +481,15 @@ GNUNET_MY_result_spec_rsa_signature (struct GNUNET_CRYPTO_RsaSignature **sig)
481 return res; 481 return res;
482} 482}
483 483
484
484/** 485/**
485 * Extract data from a Mysql database @a result at row @a row 486 * Extract data from a Mysql database @a result at row @a row
486 * 487 *
487 * @param cls closure 488 * @param cls closure
488 * @param result where to extract data from 489 * @param[in,out] rs
489 * @param int row to extract data from 490 * @param stmt the mysql statement that is being run
490 * @param fname name (or prefix) of the fields to extract from 491 * @param column the column that is being processed
491 * @param[in, out] dst_size where to store size of result, may be NULL 492 * @param[out] results
492 * @param[out] dst where to store the result
493 * @return 493 * @return
494 * #GNUNET_OK if all results could be extracted 494 * #GNUNET_OK if all results could be extracted
495 * #GNUNET_SYSERR if a result was invalid (non existing field or NULL) 495 * #GNUNET_SYSERR if a result was invalid (non existing field or NULL)
@@ -513,11 +513,10 @@ pre_extract_string (void * cls,
513 * Check size of extracted fixed size data from a Mysql database @a 513 * Check size of extracted fixed size data from a Mysql database @a
514 * 514 *
515 * @param cls closure 515 * @param cls closure
516 * @param result where to extract data from 516 * @param[in,out] rs
517 * @param int row to extract data from 517 * @param stmt the mysql statement that is being run
518 * @param fname name (or prefix) of the fields to extract from 518 * @param column the column that is being processed
519 * @param[in, out] dst_size where to store size of result, may be NULL 519 * @param[out] results
520 * @param[out] dst where to store the result
521 * @return 520 * @return
522 * #GNUNET_OK if all results could be extracted 521 * #GNUNET_OK if all results could be extracted
523 * #GNUNET_SYSERR if a result was invalid (non existing field or NULL) 522 * #GNUNET_SYSERR if a result was invalid (non existing field or NULL)
@@ -589,11 +588,10 @@ GNUNET_MY_result_spec_absolute_time_nbo (struct GNUNET_TIME_AbsoluteNBO *at)
589 * Extract data from a Postgres database @a result at row @a row. 588 * Extract data from a Postgres database @a result at row @a row.
590 * 589 *
591 * @param cls closure 590 * @param cls closure
592 * @param result where to extract data from 591 * @param[in,out] rs
593 * @param int row to extract data from 592 * @param stmt the mysql statement that is being run
594 * @param fname name (or prefix) of the fields to extract from 593 * @param column the column that is being processed
595 * @param[in,out] dst_size where to store size of result, may be NULL 594 * @param[out] results
596 * @param[out] dst where to store the result
597 * @return 595 * @return
598 * #GNUNET_YES if all results could be extracted 596 * #GNUNET_YES if all results could be extracted
599 * #GNUNET_SYSERR if a result was invalid (non-existing field or NULL) 597 * #GNUNET_SYSERR if a result was invalid (non-existing field or NULL)
@@ -618,11 +616,10 @@ pre_extract_uint16 (void *cls,
618 * Check size of extracted fixed size data from a Mysql datbase. 616 * Check size of extracted fixed size data from a Mysql datbase.
619 * 617 *
620 * @param cls closure 618 * @param cls closure
621 * @param result where to extract data from 619 * @param[in,out] rs
622 * @param int row to extract data from 620 * @param stmt the mysql statement that is being run
623 * @param fname name (or prefix) of the fields to extract from 621 * @param column the column that is being processed
624 * @param[in,out] dst_size where to store size of result, may be NULL 622 * @param[out] results
625 * @param[out] dst where to store the result
626 * @return 623 * @return
627 * #GNUNET_YES if all results could be extracted 624 * #GNUNET_YES if all results could be extracted
628 * #GNUNET_SYSERR if a result was invalid (non-existing field or NULL) 625 * #GNUNET_SYSERR if a result was invalid (non-existing field or NULL)
@@ -660,15 +657,16 @@ GNUNET_MY_result_spec_uint16 (uint16_t *u16)
660 return res; 657 return res;
661} 658}
662 659
660
663/** 661/**
664 * Extrac data from a MYSQL database @a result at row @a row 662 * Extrac data from a MYSQL database @a result at row @a row
665 * 663 *
666 * @param cls closure 664 * @param cls closure
667 * @param result where to extract data from 665 * @param cls closure
668 * @param int row to extract data from 666 * @param[in,out] rs
669 * @param fname name (or prefix) of the fields to extract from 667 * @param stmt the mysql statement that is being run
670 * @param[in, out] dst_size where to store size of result, may be NULL 668 * @param column the column that is being processed
671 * @param[out] dst where to store the result 669 * @param[out] results
672 * @return 670 * @return
673 * #GNUNET_OK if all results could be extracted 671 * #GNUNET_OK if all results could be extracted
674 * #GNUNET_SYSERR if a result was invalid (non-existing field or NULL) 672 * #GNUNET_SYSERR if a result was invalid (non-existing field or NULL)
@@ -693,11 +691,11 @@ pre_extract_uint32 (void *cls,
693 * Extrac data from a MYSQL database @a result at row @a row 691 * Extrac data from a MYSQL database @a result at row @a row
694 * 692 *
695 * @param cls closure 693 * @param cls closure
696 * @param result where to extract data from 694 * @param cls closure
697 * @param int row to extract data from 695 * @param[in,out] rs
698 * @param fname name (or prefix) of the fields to extract from 696 * @param stmt the mysql statement that is being run
699 * @param[in, out] dst_size where to store size of result, may be NULL 697 * @param column the column that is being processed
700 * @param[out] dst where to store the result 698 * @param[out] results
701 * @return 699 * @return
702 * #GNUNET_OK if all results could be extracted 700 * #GNUNET_OK if all results could be extracted
703 * #GNUNET_SYSERR if a result was invalid (non-existing field or NULL) 701 * #GNUNET_SYSERR if a result was invalid (non-existing field or NULL)
@@ -740,11 +738,10 @@ GNUNET_MY_result_spec_uint32 (uint32_t *u32)
740 * Extract data from a MYSQL database @a result at row @a row 738 * Extract data from a MYSQL database @a result at row @a row
741 * 739 *
742 * @param cls closure 740 * @param cls closure
743 * @param result where to extract data from 741 * @param[in,out] rs
744 * @param int row to extract data from 742 * @param stmt the mysql statement that is being run
745 * @param fname name (or prefix) of the fields to extract from 743 * @param column the column that is being processed
746 * @param[in, out] dst_size where to store size of result, may be null 744 * @param[out] results
747 * @param[out] dst where to store the result
748 * @return 745 * @return
749 * #GNUNET_OK if all results could be extracted 746 * #GNUNET_OK if all results could be extracted
750 * #GNUNET_SYSERR if a result was invalid (non-existing field or NULL) 747 * #GNUNET_SYSERR if a result was invalid (non-existing field or NULL)
@@ -765,16 +762,14 @@ pre_extract_uint64 (void *cls,
765} 762}
766 763
767 764
768
769/** 765/**
770 * Check size of extracted fixe size data from a Mysql database 766 * Check size of extracted fixe size data from a Mysql database
771 * 767 *
772 * @param cls closure 768 * @param cls closure
773 * @param result where to extract data from 769 * @param[in,out] rs
774 * @param int row to extract data from 770 * @param stmt the mysql statement that is being run
775 * @param fname name (or prefix) of the fields to extract from 771 * @param column the column that is being processed
776 * @param[in, out] dst_size where to store size of result, may be null 772 * @param[out] results
777 * @param[out] dst where to store the result
778 * @return 773 * @return
779 * #GNUNET_OK if all results could be extracted 774 * #GNUNET_OK if all results could be extracted
780 * #GNUNET_SYSERR if a result was invalid (non-existing field or NULL) 775 * #GNUNET_SYSERR if a result was invalid (non-existing field or NULL)
@@ -812,4 +807,5 @@ GNUNET_MY_result_spec_uint64 (uint64_t *u64)
812 return res; 807 return res;
813} 808}
814 809
810
815/* end of pq_result_helper.c */ 811/* end of pq_result_helper.c */