r8154: - fix some mem_leals
authorStefan Metzmacher <metze@samba.org>
Mon, 4 Jul 2005 17:04:36 +0000 (17:04 +0000)
committerGerald (Jerry) Carter <jerry@samba.org>
Wed, 10 Oct 2007 18:19:13 +0000 (13:19 -0500)
- check if the buffer length of the original and created buffer are equal

metze
(This used to be commit 84ff2d87e28df3e2b3c1495a9ea48f40221b96ae)

source4/torture/auth/pac.c

index 51f33781fa3d72b0a220325a6a3969313793ff9e..ebf876c651b32bd74ba2b63aeca9894c279a274c 100644 (file)
@@ -251,6 +251,7 @@ static BOOL torture_pac_saved_check(void)
                                         (ndr_pull_flags_fn_t)ndr_pull_PAC_DATA);
        if (!NT_STATUS_IS_OK(nt_status)) {
                DEBUG(0,("can't parse the PAC\n"));
                                         (ndr_pull_flags_fn_t)ndr_pull_PAC_DATA);
        if (!NT_STATUS_IS_OK(nt_status)) {
                DEBUG(0,("can't parse the PAC\n"));
+               talloc_free(mem_ctx);
                return False;
        }
 
                return False;
        }
 
@@ -258,11 +259,24 @@ static BOOL torture_pac_saved_check(void)
                                         (ndr_push_flags_fn_t)ndr_push_PAC_DATA);
        if (!NT_STATUS_IS_OK(nt_status)) {
                DEBUG(0, ("PAC push failed: %s\n", nt_errstr(nt_status)));
                                         (ndr_push_flags_fn_t)ndr_push_PAC_DATA);
        if (!NT_STATUS_IS_OK(nt_status)) {
                DEBUG(0, ("PAC push failed: %s\n", nt_errstr(nt_status)));
+               talloc_free(mem_ctx);
                return False;
        }
 
        /* dump_data(0,validate_blob.data,validate_blob.length); */
 
                return False;
        }
 
        /* dump_data(0,validate_blob.data,validate_blob.length); */
 
+       /* all we can check is the length of the buffers,
+        * to check that the alignment and padding is ok,
+        * we can't compare the bytes, because we use a different algorithm
+        * to create the pointer values
+        */
+       if (tmp_blob.length != validate_blob.length) {
+               DEBUG(0, ("PAC push failed orignial buffer length[%u] != created buffer length[%u]\n",
+                               tmp_blob.length, validate_blob.length));
+               talloc_free(mem_ctx);
+               return False;
+       }
+
        talloc_free(mem_ctx);
        return True;
 }
        talloc_free(mem_ctx);
        return True;
 }