Fix faulty free
authorRichard Levitte <levitte@openssl.org>
Sun, 29 Jan 2017 07:52:02 +0000 (08:52 +0100)
committerRichard Levitte <levitte@openssl.org>
Sun, 29 Jan 2017 14:33:44 +0000 (15:33 +0100)
commitae45175406f8dbda8cb77abcc9da5374c35a25ba
tree174438e7a071145afe3d91dc992fc7071730d04c
parent1968ea9850f7e50609284756ca78e465e5ee4fb9
Fix faulty free

On error, i2o_SCT_signature() and i2o_SCT() free a pointer that may
have wandered off from the start of the allocated block (not currently
true for i2o_SCT_signature(), but has that potential as the code may
change.  To avoid this, save away the start of the allocated block and
free that instead.

Thanks to Guido Vranken for reporting this issue.

Reviewed-by: Rich Salz <rsalz@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/2323)
(cherry picked from commit d85d3c993e322d3e4c3f00be2910faa8c55b40e3)
crypto/ct/ct_oct.c