db: Fix issue of possibly freeing an initialized pointer