Fix a file descriptor leak in off nominal path

While looking at the security vulnerability in ASTERISK-20967, Walter noticed
a file descriptor leak and some other issues in off nominal code paths. This
patch corrects them.

Note that this patch is not related to the vulnerability in ASTERISK-20967,
but the patch was placed on that issue.

(closes issue ASTERISK-20967)
Reported by: wdoekes
patches:
  issueA20967_file_leak_and_unused_wkspace.patch uploaded by wdoekes (License 5674)



git-svn-id: http://svn.asterisk.org/svn/asterisk/branches/1.8@384118 f38db490-d61c-443f-a65b-d21fe96a405b