gpgscm: Fix copying values.
authorJustus Winter <justus@g10code.com>
Tue, 4 Apr 2017 15:36:45 +0000 (17:36 +0200)
committerJustus Winter <justus@g10code.com>
Tue, 4 Apr 2017 16:48:51 +0000 (18:48 +0200)
commit6261611d3786f19fd84ccc79f45a89cadac518e8
tree0587991351692d6849f2afefd44a869b529ddddd
parenta80d4a9b50ad47eae1f8c740dd73804311e38783
gpgscm: Fix copying values.

* tests/gpgscm/scheme.c (copy_value): New function.
(mk_tagged_value): Use new function.
(opexe_4): Likewise for OP_SAVE_FORCED.
--

Occasionally, we need to copy a value from one location in the storage
to another.  Scheme objects are fine.  Some primitive objects,
however, require finalization, usually to free resources.

For these values, we either make a copy or acquire a reference.

Fixes e.g. a double free if a delayed expression evaluating to a
string is forced.

Signed-off-by: Justus Winter <justus@g10code.com>
tests/gpgscm/scheme.c