]> sigrok.org Git - pulseview.git/commit
Fix double-free issue in File::create
authorAngus Gratton <redacted>
Tue, 7 Oct 2014 22:35:23 +0000 (09:35 +1100)
committerUwe Hermann <redacted>
Wed, 8 Oct 2014 16:26:53 +0000 (18:26 +0200)
commit87b79835014a386fb51b52bc993dbb693bd27197
tree11683b806e61d0d3cfe00b90ce24528fc5c832dc
parent6842b5fc481eb43d9aeea81f17e211820d6dc405
Fix double-free issue in File::create

Triggered when opening a file from the command line.

During startup Sigsession::set_default_device calls Device::use which
loads a global _sr_session, then as part of file loading the
File::create method is called which treats _sr_session as a temp
variable (loaded then immediately released), finally a Device::release
releases the (differently allocated) global _sr_session again causing
the double free.

Given File::create is only using the sigrok session temporarily within
its function scope, this change gives it its own temporary session
instance.

This fixes bug #405.
pv/device/file.cpp