pg_auto_failover icon indicating copy to clipboard operation
pg_auto_failover copied to clipboard

Don't reference temporaries when using intToString

Open JelteF opened this issue 4 years ago • 0 comments

The following code that we use a lot is undefined behavior:

paramValues[1] = intToString(index).strValue;

Instead it should be:

IntString indexStr = intToString(index);
paramValues[1] = indexStr.strValue;

With the current code we're referencing temporaries, which can lead to all kinds of weird bugs.

Useful source: https://stackoverflow.com/a/17903361/2570866

JelteF avatar Jul 07 '21 09:07 JelteF