diff options
author | root <root@f38db490-d61c-443f-a65b-d21fe96a405b> | 2006-03-28 21:06:54 +0000 |
---|---|---|
committer | root <root@f38db490-d61c-443f-a65b-d21fe96a405b> | 2006-03-28 21:06:54 +0000 |
commit | 105b9138faf013a83743fa6382d677194662c3cd (patch) | |
tree | cb2cef8c32fa7893104aaebe70cf2ff32f7b390d | |
parent | 78cf7d090b80b453152cfe12a65147ae75e10aac (diff) |
automerge commit
git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.2-netsec@15783 f38db490-d61c-443f-a65b-d21fe96a405b
-rw-r--r-- | agi/Makefile | 2 | ||||
-rw-r--r-- | astmm.c | 7 | ||||
-rw-r--r-- | strcompat.c | 9 |
3 files changed, 8 insertions, 10 deletions
diff --git a/agi/Makefile b/agi/Makefile index 8cea3499f..42eea2cb9 100644 --- a/agi/Makefile +++ b/agi/Makefile @@ -13,7 +13,7 @@ AGIS=agi-test.agi eagi-test eagi-sphinx-test -CFLAGS+= +CFLAGS+=-DNO_AST_MM LIBS= ifeq ($(OSARCH),SunOS) @@ -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(®lock); 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); diff --git a/strcompat.c b/strcompat.c index 38615ac5d..233bacc86 100644 --- a/strcompat.c +++ b/strcompat.c @@ -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) |