dialplan: prevent memory corruption when parsing db_url

Properly allocate and use the required memory to hold the string