str: Fix bugs in ds_put_c_vformat().
authorBen Pfaff <blp@cs.stanford.edu>
Sun, 13 Jan 2019 00:41:25 +0000 (16:41 -0800)
committerBen Pfaff <blp@cs.stanford.edu>
Sun, 13 Jan 2019 00:51:10 +0000 (16:51 -0800)
commit9ceda5b4082cf665b5279cc5c56ecbe4fd44fb15
tree521bb3a79547d0a04d5ba26d517143c8c79dfd38
parentc60cba893280a910c4389617d5ae62d21d54a9c5
str: Fix bugs in ds_put_c_vformat().

This code used c_vasnprintf() as if it had the same interface as
vsnprintf(), but it's quite different.  It is necessary to make note of its
return value and possibly free it.  The code previously here didn't do
that, which led to memory leaks and possibly worse problems.  (Fortunately
this function isn't used much.)

Memory leak found by Address Sanitizer.
src/libpspp/str.c