Fix segfault on errors emitting.
Fix segfault on errors emitting.

Function 'pkg_emit_error' calls for pkg_emit_event twice and, moreover,
the first time it is called with uninitialized buffer, hence causing
SIGSEGV while accessing this buffer further. This patch fixes it.

en90/pkg,khorben/pkg,khorben/pkg,junovitch/pkg,junovitch/pkg,Open343/pkg,skoef/pkg,Open343/pkg,skoef/pkg,khorben/pkg,en90/pkg