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