svn commit: samba r25798 - in branches/SAMBA_4_0/source/librpc/ndr: .

metze at samba.org metze at samba.org
Fri Nov 2 11:01:19 GMT 2007


Author: metze
Date: 2007-11-02 11:01:18 +0000 (Fri, 02 Nov 2007)
New Revision: 25798

WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=25798

Log:
- check return value of ndr_push_set_switch_value()
- fix memory leaks in error pathes

metze
Modified:
   branches/SAMBA_4_0/source/librpc/ndr/ndr.c


Changeset:
Modified: branches/SAMBA_4_0/source/librpc/ndr/ndr.c
===================================================================
--- branches/SAMBA_4_0/source/librpc/ndr/ndr.c	2007-11-02 10:59:43 UTC (rev 25797)
+++ branches/SAMBA_4_0/source/librpc/ndr/ndr.c	2007-11-02 11:01:18 UTC (rev 25798)
@@ -843,6 +843,7 @@
 	ndr->flags |= flags | LIBNDR_FLAG_NO_NDR_SIZE;
 	status = push(ndr, NDR_SCALARS|NDR_BUFFERS, discard_const(p));
 	if (!NT_STATUS_IS_OK(status)) {
+		talloc_free(ndr);
 		return 0;
 	}
 	ret = ndr->offset;
@@ -865,9 +866,15 @@
 	ndr = ndr_push_init_ctx(NULL);
 	if (!ndr) return 0;
 	ndr->flags |= flags | LIBNDR_FLAG_NO_NDR_SIZE;
-	ndr_push_set_switch_value(ndr, p, level);
+
+	status = ndr_push_set_switch_value(ndr, p, level);
+	if (!NT_STATUS_IS_OK(status)) {
+		talloc_free(ndr);
+		return 0;
+	}
 	status = push(ndr, NDR_SCALARS|NDR_BUFFERS, p);
 	if (!NT_STATUS_IS_OK(status)) {
+		talloc_free(ndr);
 		return 0;
 	}
 	ret = ndr->offset;



More information about the samba-cvs mailing list