Don't initialize return values on rpmReadHeader() entry
For consistency with rpmReadPackageFile() (which changed behavior similarly in the grand package read unification) and common practise, only set return values pointers when we have something to return. Other than that, everybody gets to initialize their own variables. Also don't dereference msg, we really dont need to know whether it points to a NULL string ornot in order to set it.
This commit is contained in:
parent
7d2ead6c5f
commit
8156b937d9
|
@ -198,23 +198,18 @@ 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 && *msg == NULL && buf != NULL) {
|
||||
if (msg != NULL && buf != NULL) {
|
||||
*msg = buf;
|
||||
} else {
|
||||
free(buf);
|
||||
|
|
Loading…
Reference in New Issue