Revert "Don't initialize return values on rpmReadHeader() entry"

Similar to commit 73c76f5999, revert
to the old behavior which is actually documented for this API.

This reverts commit 8156b937d9.
This commit is contained in:
Panu Matilainen 2017-10-04 10:25:12 +03:00
parent 73c76f5999
commit 882669ba0f
1 changed files with 7 additions and 2 deletions

View File

@ -198,18 +198,23 @@ rpmRC rpmReadHeader(rpmts ts, FD_t fd, Header *hdrp, char ** msg)
Header h = NULL;
rpmRC rc = RPMRC_FAIL; /* assume failure */
if (hdrp)
*hdrp = NULL;
if (msg)
*msg = NULL;
if (hdrblobRead(fd, 1, 1, RPMTAG_HEADERIMMUTABLE, &blob, &buf) != RPMRC_OK)
goto exit;
/* OK, blob looks sane, load the header. */
rc = hdrblobImport(&blob, 0, &h, &buf);
exit:
if (hdrp && h && rc == RPMRC_OK)
*hdrp = headerLink(h);
exit:
headerFree(h);
if (msg != NULL && buf != NULL) {
if (msg != NULL && *msg == NULL && buf != NULL) {
*msg = buf;
} else {
free(buf);