pq: do not modify the ptr passed in ResultSpec

This commit is contained in:
Sree Harsha Totakura 2015-04-29 13:04:10 +02:00
parent 6a584e6c8a
commit 5a8eccb4c4

View File

@ -90,6 +90,7 @@ TALER_PQ_extract_result (PGresult *result,
unsigned int i; unsigned int i;
unsigned int j; unsigned int j;
const char *res; const char *res;
void *dst;
int fnum; int fnum;
for (i=0; NULL != rs[i].fname; i++) for (i=0; NULL != rs[i].fname; i++)
@ -145,10 +146,12 @@ TALER_PQ_extract_result (PGresult *result,
if (NULL != rs[i].result_size) if (NULL != rs[i].result_size)
*rs[i].result_size = len; *rs[i].result_size = len;
rs[i].dst_size = len; rs[i].dst_size = len;
*((void **) rs[i].dst) = GNUNET_malloc (len); dst = GNUNET_malloc (len);
rs[i].dst = * ((void **) rs[i].dst); *((void **) rs[i].dst) = dst;
} }
memcpy (rs[i].dst, else
dst = rs[i].dst;
memcpy (dst,
res, res,
len); len);
} }