URL:
https://github.com/SSSD/sssd/pull/740
Title: #740: sbus: avoid using invalid stack point in SBUS_INTERFACE
alexey-tikhonov commented:
"""
* Consider following snippet:
```
struct sbus_interface dbus;
{
/* ... some code ... */
SBUS_INTERFACE(tmp, ...);
/* ... some code ... */
dbus = tmp;
}
/* do something with dbus, that contain pointers to variables went out of scope */
```
While I can't give a good reason to write code this way, still it _may seem_ to be
valid, taking into account that `struct sbus_interface` contains only pointers to const
data.
Actually it doesn't matter that `struct sbus_interface` contains only pointers to
const data.
What I want to say: we do not cleanup explicitly content of `tmp` variable so one might
reasonably expect that `dbus = tmp;` results in a valid variable `dbus` in this example.
But content of `tmp` is destroyed **implicitly** leading to invalid `dbus` that seems to
be little unexpected.
Still those are nitpicks. But good if somebody else will take a look.
"""
See the full comment at
https://github.com/SSSD/sssd/pull/740#issuecomment-460326525