Index: libabac/abac.c
===================================================================
--- libabac/abac.c	(revision f2622eedaed62afb331d995b5b1c5f298b24bb11)
+++ libabac/abac.c	(revision 7764378b5c92476562993a0bfa5f027128c1bc48)
@@ -115,10 +115,8 @@
  * Load an ID cert from a id.
  */
-/*
-int abac_context_load_id_chunk(abac_context_t *ctx, abac_id_t *id) {
+int abac_context_load_id_id(abac_context_t *ctx, abac_id_t *id) {
     assert(ctx != NULL);
     return abac_verifier_load_id_id(ctx->id_certs,id, ctx->keymap);
 }
-*/
 
 
@@ -143,7 +141,7 @@
                 abac_credential_free(cred);
             );
-            abac_list_free(cred_list);
         }
     }
+    abac_list_free(cred_list);
     return ret;
 }
@@ -237,5 +235,4 @@
         *success = 0;
         abac_list_free(result);
-	result_graph = abac_graph_new();
 
 	// TODO: This can probably be better, but it now returns an
Index: libabac/abac.h
===================================================================
--- libabac/abac.h	(revision f2622eedaed62afb331d995b5b1c5f298b24bb11)
+++ libabac/abac.h	(revision 7764378b5c92476562993a0bfa5f027128c1bc48)
@@ -21,4 +21,6 @@
     int len;
 } abac_chunk_t;
+void abac_chunk_free(abac_chunk_t);
+
 #endif /* __ABAC_CHUNK_T__ */
 
@@ -36,4 +38,5 @@
 int abac_context_load_id_file(abac_context_t *ctx, char *filename);
 int abac_context_load_id_chunk(abac_context_t *ctx, abac_chunk_t cert);
+int abac_context_load_id_id(abac_context_t *ctx, abac_id_t *cert);
 int abac_context_load_attribute_file(abac_context_t *ctx, char *filename);
 int abac_context_load_attribute_chunk(abac_context_t *ctx, abac_chunk_t cert);
Index: libabac/abac.hh
===================================================================
--- libabac/abac.hh	(revision f2622eedaed62afb331d995b5b1c5f298b24bb11)
+++ libabac/abac.hh	(revision 7764378b5c92476562993a0bfa5f027128c1bc48)
@@ -45,4 +45,7 @@
      load id certificate from an chunk
      (C:abac_context_load_id_chunk)
+f  int load_id_id(ID&)
+     load id certificate from an existing ID
+     (C:abac_context_load_id_id)
 f  int load_attribute_file(char *)
      load attribute certificate from an id file. 
@@ -58,4 +61,5 @@
             int load_id_file(char *filename) { return abac_context_load_id_file(m_ctx, filename); }
             int load_id_chunk(abac_chunk_t cert) { return abac_context_load_id_chunk(m_ctx, cert); }
+            int load_id_id(ID& id); /* defined later in the class */
             int load_attribute_file(char *filename) { return abac_context_load_attribute_file(m_ctx, filename); }
             int load_attribute_chunk(abac_chunk_t cert) { return abac_context_load_attribute_chunk(m_ctx, cert); }
@@ -130,4 +134,5 @@
             abac_context_t *m_ctx;
 	friend class Role;
+        friend class ID;
 	friend class Attribute;
     };
@@ -455,4 +460,5 @@
 
             friend class Attribute;
+            friend class Context;
 
         private:
@@ -636,4 +642,7 @@
             abac_attribute_t *m_attr;
     };
+
+    int Context::load_id_id(ID& id)
+    { return abac_context_load_id_id(m_ctx, id.m_id); }
 }
 
Index: libabac/abac_attribute.c
===================================================================
--- libabac/abac_attribute.c	(revision f2622eedaed62afb331d995b5b1c5f298b24bb11)
+++ libabac/abac_attribute.c	(revision 7764378b5c92476562993a0bfa5f027128c1bc48)
@@ -481,5 +481,4 @@
     if ( attr->keymap ) abac_keyid_map_free(attr->keymap);
 
-/* MEI???, this can not be free as if it is a char string */
     free(attr->cert.ptr);
 
Index: libabac/abac_util.h
===================================================================
--- libabac/abac_util.h	(revision f2622eedaed62afb331d995b5b1c5f298b24bb11)
+++ libabac/abac_util.h	(revision 7764378b5c92476562993a0bfa5f027128c1bc48)
@@ -13,6 +13,6 @@
 #endif /* __ABAC_CHUNK_T__ */
 
+void abac_chunk_free(abac_chunk_t);
 void *abac_xmalloc(size_t);
-void abac_chunk_free(abac_chunk_t);
 char *abac_xstrdup(char *);
 void *abac_xrealloc(void *, size_t);
Index: libabac/abac_verifier.c
===================================================================
--- libabac/abac_verifier.c	(revision f2622eedaed62afb331d995b5b1c5f298b24bb11)
+++ libabac/abac_verifier.c	(revision 7764378b5c92476562993a0bfa5f027128c1bc48)
@@ -187,4 +187,16 @@
 
 /**
+ * Load an ID cert with an id
+ */
+int abac_verifier_load_id_id(abac_list_t *id_certs,abac_id_t *id, 
+	abac_keyid_map_t *km) {
+
+    if (id == NULL)
+        return ABAC_CERT_INVALID;
+
+    return _load_id(id_certs,&id, km);
+}
+
+/**
  * Load an ID cert from a char ptr of a X509 pem data
  * this is called from parse_privilege/parse_abac
@@ -311,5 +323,6 @@
         );
     }
-/* ??? MEI, attr is being reused, just free the list ptr */
+
+/* just free the list ptr */
     abac_list_free(attr_list);
     return sz;
@@ -324,6 +337,8 @@
     abac_list_t *attr_list = abac_attribute_certs_from_file(id_certs,filename);
 
-    if (abac_list_size(attr_list) == 0)
-        return ABAC_CERT_INVALID;
+    if (abac_list_size(attr_list) == 0) {
+        abac_list_free(attr_list);
+        return ABAC_CERT_INVALID;
+    }
 
     int ret=_load_attribute_certs(id_certs,attr_list, cred_list, km);
Index: libabac/options.c
===================================================================
--- libabac/options.c	(revision f2622eedaed62afb331d995b5b1c5f298b24bb11)
+++ libabac/options.c	(revision 7764378b5c92476562993a0bfa5f027128c1bc48)
@@ -19,4 +19,12 @@
     );
     exit(1);
+}
+
+void free_options(options_t *opts)
+{            
+    if(opts->keystore) free(opts->keystore); 
+    if(opts->role) free(opts->role);
+    if(opts->principal) free(opts->principal);
+    if(opts->rulefile) free(opts->rulefile);
 }
 
Index: libabac/options.h
===================================================================
--- libabac/options.h	(revision f2622eedaed62afb331d995b5b1c5f298b24bb11)
+++ libabac/options.h	(revision 7764378b5c92476562993a0bfa5f027128c1bc48)
@@ -14,4 +14,5 @@
 
 void get_options(int argc, char **argv, options_t *opts);
+void free_options(options_t *opts);
 
 #ifdef __cplusplus
Index: libabac/prover.c
===================================================================
--- libabac/prover.c	(revision f2622eedaed62afb331d995b5b1c5f298b24bb11)
+++ libabac/prover.c	(revision 7764378b5c92476562993a0bfa5f027128c1bc48)
@@ -73,4 +73,5 @@
     abac_context_credentials_free(credentials);
     abac_context_free(ctx);
+    free_options(&opts);
 
     if(success) {
