commit 5a8eccb4c4d6eb03007564871947f3a1bd873ad2
parent 6a584e6c8a80c96486f763308b6437d9f643ca8e
Author: Sree Harsha Totakura <sreeharsha@totakura.in>
Date: Wed, 29 Apr 2015 13:04:10 +0200
pq: do not modify the ptr passed in ResultSpec
Diffstat:
1 file changed, 6 insertions(+), 3 deletions(-)
diff --git a/src/pq/db_pq.c b/src/pq/db_pq.c
@@ -90,6 +90,7 @@ TALER_PQ_extract_result (PGresult *result,
unsigned int i;
unsigned int j;
const char *res;
+ void *dst;
int fnum;
for (i=0; NULL != rs[i].fname; i++)
@@ -145,10 +146,12 @@ TALER_PQ_extract_result (PGresult *result,
if (NULL != rs[i].result_size)
*rs[i].result_size = len;
rs[i].dst_size = len;
- *((void **) rs[i].dst) = GNUNET_malloc (len);
- rs[i].dst = * ((void **) rs[i].dst);
+ dst = GNUNET_malloc (len);
+ *((void **) rs[i].dst) = dst;
}
- memcpy (rs[i].dst,
+ else
+ dst = rs[i].dst;
+ memcpy (dst,
res,
len);
}