--- rpm-4.4.2/lib/verify.c.contextverify 2005-09-22 13:24:09.000000000 -0400 +++ rpm-4.4.2/lib/verify.c 2005-09-22 13:38:17.000000000 -0400 @@ -122,24 +122,29 @@ */ /*@-branchstate@*/ if (selinuxEnabled == 1 && (flags & RPMVERIFY_CONTEXTS)) { - security_context_t con; + security_context_t con = NULL; rc = lgetfilecon(fn, &con); if (rc == -1) *res |= (RPMVERIFY_LGETFILECONFAIL|RPMVERIFY_CONTEXTS); else { - security_context_t fcontext; + security_context_t fcontext = NULL; /* Get file security context from patterns. */ if (matchpathcon(fn,fmode,&fcontext) != 0) { /* Get file security context from package. */ - fcontext = rpmfiFContext(fi); + char * ficontext = NULL; + ficontext = rpmfiFContext(fi); + fcontext = xmalloc(sizeof(ficontext)); + strncpy(fcontext, ficontext, sizeof(ficontext)); } if (fcontext == NULL || strcmp(fcontext, con)) *res |= RPMVERIFY_CONTEXTS; - freecon(con); - freecon(fcontext); + if (con != NULL) + freecon(con); + if (fcontext != NULL) + freecon(fcontext); } }