Clean up some memory leaks by releasing context
authorEzra Peisach <epeisach@mit.edu>
Sun, 22 Nov 2009 04:26:48 +0000 (04:26 +0000)
committerEzra Peisach <epeisach@mit.edu>
Sun, 22 Nov 2009 04:26:48 +0000 (04:26 +0000)
git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@23299 dc483132-0cff-0310-8789-dd5450dbe970

src/lib/kadm5/unit-test/destroy-test.c
src/lib/kadm5/unit-test/init-test.c

index b12d42fa64ffd069c35f9121d6937cacaa38a9a3..ccca24928b259612063d8778b123684849e15dac 100644 (file)
@@ -43,5 +43,6 @@ int main()
         }
         free(cp);
     }
+    krb5_free_context(context);
     exit(0);
 }
index a7f065db507985bee3d1a4661762d80e2268db12..354b812b67bf2ecf729a40acbc2443f7e0f61921 100644 (file)
@@ -23,14 +23,17 @@ int main()
     ret = kadm5_init(context, "admin", "admin", NULL, &params,
                      KADM5_STRUCT_VERSION, KADM5_API_VERSION_3, NULL,
                      &server_handle);
-    if (ret == KADM5_RPC_ERROR)
+    if (ret == KADM5_RPC_ERROR) {
+        krb5_free_context(context);
         exit(0);
+    }
     else if (ret != 0) {
         com_err("init-test", ret, "while initializing without auth");
         exit(1);
     } else {
         fprintf(stderr, "Unexpected success while initializing without auth!\n");
         (void) kadm5_destroy(server_handle);
+        krb5_free_context(context);
         exit(1);
     }
 }