Clean up TR_MSG, hopefully getting talloc context handling right
authorJennifer Richards <jennifer@painless-security.com>
Tue, 17 Apr 2018 16:07:56 +0000 (12:07 -0400)
committerJennifer Richards <jennifer@painless-security.com>
Tue, 17 Apr 2018 16:07:56 +0000 (12:07 -0400)
commite20e7787d7bd5c1f89ddfcc48fc52054b65423d8
treec9e33b6b00fef6748503488030fd7f2ab21e47c0
parent4d39775e0301d6e3bb9c5ea85f10b10e5b420624
Clean up TR_MSG, hopefully getting talloc context handling right

I had assumed in a few places that TR_MSGs and the various message
payload types were always allocated dynamically via talloc(). This is
not a safe assumption - in a few places, we use stack-allocated TR_MSGs
and these are all used outside our code via the libtr_tid library.
We now use talloc when we can (i.e., when we have encoded or decoded
a message and know we used talloc), but otherwise leave it to the calling
code to properly manage memory.
common/tr_msg.c