fdo#80574 firebird memory management issues

Change-Id: I37438cd3f9c8e197e5a3aa3d9cbcc5bf3681d792