summaryrefslogtreecommitdiff
path: root/src/pq
diff options
context:
space:
mode:
authorSree Harsha Totakura <sreeharsha@totakura.in>2015-04-29 13:04:10 +0200
committerSree Harsha Totakura <sreeharsha@totakura.in>2015-04-29 13:04:10 +0200
commit5a8eccb4c4d6eb03007564871947f3a1bd873ad2 (patch)
treee47c573eb9395d6c01c68fce86c2c5d80d39f0cf /src/pq
parent6a584e6c8a80c96486f763308b6437d9f643ca8e (diff)
downloadexchange-5a8eccb4c4d6eb03007564871947f3a1bd873ad2.tar.gz
exchange-5a8eccb4c4d6eb03007564871947f3a1bd873ad2.tar.bz2
exchange-5a8eccb4c4d6eb03007564871947f3a1bd873ad2.zip
pq: do not modify the ptr passed in ResultSpec
Diffstat (limited to 'src/pq')
-rw-r--r--src/pq/db_pq.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/pq/db_pq.c b/src/pq/db_pq.c
index 1e96f8c39..1ec6e8a73 100644
--- 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);
}