-fix leaks

This commit is contained in:
Christian Grothoff 2015-07-09 22:29:10 +02:00
parent be535b68e1
commit 1e7bef9762
3 changed files with 9 additions and 8 deletions

View File

@ -105,7 +105,6 @@ handle_mhd_completion_callback (void *cls,
void **con_cls, void **con_cls,
enum MHD_RequestTerminationCode toe) enum MHD_RequestTerminationCode toe)
{ {
fprintf (stderr, "CC called (%p)!\n", *con_cls);
if (NULL == *con_cls) if (NULL == *con_cls)
return; return;
TMH_PARSE_post_cleanup_callback (*con_cls); TMH_PARSE_post_cleanup_callback (*con_cls);

View File

@ -29,13 +29,12 @@
/** /**
* Initial size for POST * Initial size for POST request buffer.
* request buffer.
*/ */
#define REQUEST_BUFFER_INITIAL 1024 #define REQUEST_BUFFER_INITIAL (2*1024)
/** /**
* Maximum POST request size * Maximum POST request size.
*/ */
#define REQUEST_BUFFER_MAX (1024*1024) #define REQUEST_BUFFER_MAX (1024*1024)
@ -131,6 +130,7 @@ buffer_append (struct Buffer *buf,
return GNUNET_NO; return GNUNET_NO;
new_buf = GNUNET_malloc (new_size); new_buf = GNUNET_malloc (new_size);
memcpy (new_buf, buf->data, buf->fill); memcpy (new_buf, buf->data, buf->fill);
GNUNET_free (buf->data);
buf->data = new_buf; buf->data = new_buf;
buf->alloc = new_size; buf->alloc = new_size;
} }
@ -273,7 +273,6 @@ TMH_PARSE_post_json (struct MHD_Connection *connection,
? GNUNET_SYSERR : GNUNET_NO; ? GNUNET_SYSERR : GNUNET_NO;
} }
/* everything OK, wait for more POST data */ /* everything OK, wait for more POST data */
fprintf (stderr, "Init %p\n", r);
*upload_data_size = 0; *upload_data_size = 0;
*con_cls = r; *con_cls = r;
return GNUNET_YES; return GNUNET_YES;
@ -315,8 +314,6 @@ TMH_PARSE_post_json (struct MHD_Connection *connection,
TMH_RESPONSE_reply_invalid_json (connection)) TMH_RESPONSE_reply_invalid_json (connection))
? GNUNET_NO : GNUNET_SYSERR; ? GNUNET_NO : GNUNET_SYSERR;
} }
fprintf (stderr, "Deinit %p\n", r);
buffer_deinit (r); buffer_deinit (r);
GNUNET_free (r); GNUNET_free (r);
*con_cls = NULL; *con_cls = NULL;

View File

@ -3030,6 +3030,7 @@ postgres_get_coin_transactions (void *cls,
if (PGRES_TUPLES_OK != PQresultStatus (result)) if (PGRES_TUPLES_OK != PQresultStatus (result))
{ {
QUERY_ERR (result); QUERY_ERR (result);
PQclear (result);
goto cleanup; goto cleanup;
} }
nrows = PQntuples (result); nrows = PQntuples (result);
@ -3072,6 +3073,7 @@ postgres_get_coin_transactions (void *cls,
{ {
GNUNET_break (0); GNUNET_break (0);
GNUNET_free (deposit); GNUNET_free (deposit);
PQclear (result);
goto cleanup; goto cleanup;
} }
deposit->coin.coin_pub = *coin_pub; deposit->coin.coin_pub = *coin_pub;
@ -3083,6 +3085,7 @@ postgres_get_coin_transactions (void *cls,
head = tl; head = tl;
continue; continue;
} }
PQclear (result);
} }
/* Handle refreshing */ /* Handle refreshing */
{ {
@ -3129,6 +3132,7 @@ postgres_get_coin_transactions (void *cls,
{ {
GNUNET_break (0); GNUNET_break (0);
GNUNET_free (melt); GNUNET_free (melt);
PQclear (result);
goto cleanup; goto cleanup;
} }
} }
@ -3139,6 +3143,7 @@ postgres_get_coin_transactions (void *cls,
head = tl; head = tl;
continue; continue;
} }
PQclear (result);
} }
/* FIXME: Handle locked coins (#3625) */ /* FIXME: Handle locked coins (#3625) */
return head; return head;