[SR-Dev] git:ser_core_cvs: Safety check added to verify whether the static buffers have

Andrei Pelinescu-Onciul andrei at iptel.org
Thu Apr 16 13:25:04 CEST 2009


Module: sip-router
Branch: ser_core_cvs
Commit: d1e2ffe61fb19810e7fc9bf23b21b8580cc6c696
URL:    http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=d1e2ffe61fb19810e7fc9bf23b21b8580cc6c696

Author: Miklos Tirpak <miklos at iptel.org>
Committer: Miklos Tirpak <miklos at iptel.org>
Date:   Tue Apr  7 09:07:48 2009 +0000

Safety check added to verify whether the static buffers have
been initialized.

---

 select_buf.c |    9 +++++++++
 1 files changed, 9 insertions(+), 0 deletions(-)

diff --git a/select_buf.c b/select_buf.c
index 1037391..3a6ae24 100644
--- a/select_buf.c
+++ b/select_buf.c
@@ -105,6 +105,15 @@ static int allocate_buffer(int req_size) {
 
 char* get_static_buffer(int req_size) {
 	char *p = NULL;
+
+#ifdef EXTRA_DEBUG
+	if ((active_buffer < 0) || (active_buffer > MAX_BUFFERS-1)) {
+		LOG(L_CRIT, "BUG: buffers have not been initialized yet. "
+			"Call reset_static_buffer() before executing "
+			"a route block.\n");
+		abort();
+	}
+#endif
 	if ((buffer[active_buffer].size >= buffer[active_buffer].offset + req_size)
 			|| (allocate_buffer(req_size))) {
 		/* enough space in current buffer or allocation successful */




More information about the sr-dev mailing list