]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
automerge commit
authorAutomerge script <automerge@asterisk.org>
Tue, 28 Mar 2006 21:06:54 +0000 (21:06 +0000)
committerAutomerge script <automerge@asterisk.org>
Tue, 28 Mar 2006 21:06:54 +0000 (21:06 +0000)
git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.2-netsec@15783 65c4cc65-6c06-0410-ace0-fbb531ad65f3

agi/Makefile
astmm.c
strcompat.c

index 8cea3499f4b96ec218f285478c2f939b3e9fdcfe..42eea2cb9eccae97f3e6f2e11318f49b73675644 100644 (file)
@@ -13,7 +13,7 @@
 
 AGIS=agi-test.agi eagi-test eagi-sphinx-test
 
-CFLAGS+=
+CFLAGS+=-DNO_AST_MM
 
 LIBS=
 ifeq ($(OSARCH),SunOS)
diff --git a/astmm.c b/astmm.c
index 3f94e05fadbc5928c5c9314a8f9c46d68b685c0b..b542bc97a69a18f7cdf84e919a0be04a81f3ccc2 100644 (file)
--- a/astmm.c
+++ b/astmm.c
@@ -37,6 +37,7 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
 #include "asterisk/options.h"
 #include "asterisk/lock.h"
 #include "asterisk/strings.h"
+#include "asterisk/unaligned.h"
 
 #define SOME_PRIME 563
 
@@ -99,7 +100,7 @@ static inline void *__ast_alloc_region(size_t size, int which, const char *file,
                regions[hash] = reg;
                reg->fence = FENCE_MAGIC;
                fence = (ptr + reg->len);
-               *fence = FENCE_MAGIC;
+               put_unaligned_uint32(fence, FENCE_MAGIC);
        }
        ast_mutex_unlock(&reglock);
        if (!reg) {
@@ -161,7 +162,7 @@ static void __ast_free_region(void *ptr, const char *file, int lineno, const cha
                                fflush(mmlog);
                        }
                }
-               if (*fence != FENCE_MAGIC) {
+               if (get_unaligned_uint32(fence) != FENCE_MAGIC) {
                        fprintf(stderr, "WARNING: High fence violation at %p, in %s of %s, line %d\n", reg->data, reg->func, reg->file, reg->lineno);
                        if (mmlog) {
                                fprintf(mmlog, "%ld - WARNING: High fence violation at %p, in %s of %s, line %d\n", time(NULL), reg->data, reg->func, reg->file, reg->lineno);
@@ -296,7 +297,7 @@ static int handle_show_memory(int fd, int argc, char *argv[])
                                                fflush(mmlog);
                                        }
                                }
-                               if (*fence != FENCE_MAGIC) {
+                               if (get_unaligned_uint32(fence) != FENCE_MAGIC) {
                                        fprintf(stderr, "WARNING: High fence violation at %p, in %s of %s, line %d\n", reg->data, reg->func, reg->file, reg->lineno);
                                        if (mmlog) {
                                                fprintf(mmlog, "%ld - WARNING: High fence violation at %p, in %s of %s, line %d\n", time(NULL), reg->data, reg->func, reg->file, reg->lineno);
index 38615ac5d0a77ed5f94652b6fadfdd8acc7c9775..233bacc86225d6dcc68bc6c2ef5dc5df53b40bf8 100644 (file)
@@ -33,21 +33,18 @@ char* strsep(char** str, const char* delims)
 int setenv(const char *name, const char *value, int overwrite)
 {
        unsigned char *buf;
-       int buflen, ret;
+       int buflen;
 
        buflen = strlen(name) + strlen(value) + 2;
-       if ((buf = malloc(buflen)) == NULL)
+       if (!(buf = alloca(buflen)))
                return -1;
 
        if (!overwrite && getenv(name))
                return 0;
 
        snprintf(buf, buflen, "%s=%s", name, value);
-       ret = putenv(buf);
 
-       free(buf);
-
-       return ret;
+       return putenv(buf);
 }
 
 int unsetenv(const char *name)