Module: sip-router Branch: ser_core_cvs Commit: d1e2ffe61fb19810e7fc9bf23b21b8580cc6c696 URL: http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=d1e2ffe6...
Author: Miklos Tirpak miklos@iptel.org Committer: Miklos Tirpak miklos@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 */