[Asterisk-cvs] asterisk/apps app_chanspy.c,1.12,1.13

anthm at lists.digium.com anthm at lists.digium.com
Sun Apr 3 10:53:24 CDT 2005


Update of /usr/cvsroot/asterisk/apps
In directory mongoose.digium.com:/tmp/cvs-serv26042/apps

Modified Files:
	app_chanspy.c 
Log Message:
forgot some code from the last chanspy repass (nothing exciting)

Index: app_chanspy.c
===================================================================
RCS file: /usr/cvsroot/asterisk/apps/app_chanspy.c,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -d -r1.12 -r1.13
--- app_chanspy.c	1 Apr 2005 16:09:52 -0000	1.12
+++ app_chanspy.c	3 Apr 2005 15:46:22 -0000	1.13
@@ -313,6 +313,20 @@
 					return 0;
 				}
 			} else {
+				if (csth->len0 < f0->datalen) {
+					if (!csth->len0) {
+						if (!(csth->buf0 = malloc(f0->datalen * 2))) {
+							csth->spy.status = CHANSPY_DONE;
+							return -1;
+						}
+					} else {
+						if (!realloc(csth->buf0, f0->datalen * 2)) {
+							csth->spy.status = CHANSPY_DONE;
+							return -1;
+						}
+					}
+					csth->len0 = f0->datalen;
+				}
 				memcpy(csth->buf0, f0->data, f0->datalen);
 				maxsamp = f0->samples;
 			}
@@ -323,12 +337,12 @@
 				if ((f = ast_translate(csth->trans1, f1, 0))) {
 					if (csth->len1 < f->datalen) {
 						if (!csth->len1) {
-							if (!(csth->buf1 = malloc(f->datalen))) {
+							if (!(csth->buf1 = malloc(f->datalen * 2))) {
 								csth->spy.status = CHANSPY_DONE;
 								return -1;
 							}
 						} else {
-							if (!realloc(csth->buf1, f->datalen)) {
+							if (!realloc(csth->buf1, f->datalen * 2)) {
 								csth->spy.status = CHANSPY_DONE;
 								return -1;
 							}
@@ -345,6 +359,20 @@
 					return 0;
 				}
 			} else {
+				if (csth->len1 < f1->datalen) {
+					if (!csth->len1) {
+						if (!(csth->buf1 = malloc(f1->datalen * 2))) {
+							csth->spy.status = CHANSPY_DONE;
+							return -1;
+						}
+					} else {
+						if (!realloc(csth->buf1, f1->datalen * 2)) {
+							csth->spy.status = CHANSPY_DONE;
+							return -1;
+						}
+					}
+					csth->len1 = f1->datalen;
+				}
 				memcpy(csth->buf1, f1->data, f1->datalen);
 				if (f1->samples > maxsamp) {
 					maxsamp = f1->samples;




More information about the svn-commits mailing list