h->flags &= ~HEADERFLAG_SORTED;
headerSort(h);
+ h->flags |= HEADERFLAG_ALLOCATED;
return h;
uh = _free(uh);
return NULL;
}
- if (nh->flags & HEADERFLAG_ALLOCATED)
- uh = _free(uh);
- nh->flags |= HEADERFLAG_ALLOCATED;
if (ENTRY_IS_REGION(nh->index)) {
if (tag == HEADER_SIGNATURES || tag == HEADER_IMMUTABLE)
nh->index[0].info.tag = tag;
/* Sanity checks on header intro. */
if (!(hdrchkTags(il) || hdrchkData(dl)) && pvlen < headerMaxbytes) {
nuh = memcpy(xmalloc(pvlen), uh, pvlen);
- if ((h = headerLoad(nuh)) != NULL)
- h->flags |= HEADERFLAG_ALLOCATED;
+ if ((h = headerLoad(nuh)) == NULL)
+ nuh = _free(nuh);
}
- if (h == NULL)
- nuh = _free(nuh);
return h;
}
h = headerLoad(ei);
exit:
- if (h) {
- if (h->flags & HEADERFLAG_ALLOCATED)
- ei = _free(ei);
- h->flags |= HEADERFLAG_ALLOCATED;
- } else if (ei)
- ei = _free(ei);
+ if (h == NULL && ei != NULL) {
+ free(ei);
+ }
return h;
}
rc = RPMRC_FAIL;
goto exit;
}
- h->flags |= HEADERFLAG_ALLOCATED;
ei = NULL; /* XXX will be freed with header */
exit:
#include "lib/rpmdb_internal.h"
#include "lib/fprint.h"
-#include "lib/header_internal.h" /* XXX for HEADERFLAG_ALLOCATED */
+#include "lib/header_internal.h" /* XXX for headerSetInstance() */
#include "debug.h"
int _rpmdb_debug = 0;
/* Did the header blob load correctly? */
#if !defined(_USE_COPY_LOAD)
mi->mi_h = headerLoad(uh);
- if (mi->mi_h)
- mi->mi_h->flags |= HEADERFLAG_ALLOCATED;
#else
mi->mi_h = headerCopyLoad(uh);
#endif
rasprintf(&buf, _("sigh load: BAD\n"));
goto exit;
}
- sigh->flags |= HEADERFLAG_ALLOCATED;
{ size_t sigSize = headerSizeof(sigh, HEADER_MAGIC_YES);
size_t pad = (8 - (sigSize % 8)) % 8; /* 8-byte pad */
goto exit;
}
}
+ ei = NULL; /* XXX will be freed with header */
exit:
if (sighp && sigh && rc == RPMRC_OK)
*sighp = headerLink(sigh);
sigh = headerFree(sigh);
+ free(ei);
if (msg != NULL) {
*msg = buf;