util, tlm: Fix a memory error in the SCMasterPort class.

In the b_transport method of the SCMasterPort class, there is a check
which determines whether the packet being sent to gem5 should be
deleted once the call to sendAtomic returns. This was deleting the
packet if extension was *not* nullptr.

This check should delete the packet if the extension *is* nullptr. The
reasoning is that the extension will equal nullptr if there was no
gem5 packet in an extension and a new one needed to be allocated. If
there was an extension, ie if extension is not nullptr, then that's
where the packet came from which therefore doesn't belong to us. In
that case, we need to leave it alone and let its owner clean it up.

With the check reversed, this method will either leak allocated packets
it should delete, or delete packets it shouldn't that someone else will
likely try to use later.

Change-Id: I61578d910be6e5085b9fc0ddaa82468b1ac68578
Reviewed-on: https://gem5-review.googlesource.com/c/16949
Reviewed-by: Jason Lowe-Power <jason@lowepower.com>
Maintainer: Gabe Black <gabeblack@google.com>
1 file changed