1.50b: memleak fix, change some exit() to abort()

- abort() instead of exit() in several places.
- Cleaned up mem leak, incorrect use of ck_free() in IDN handling.
This commit is contained in:
Steve Pinkham 2010-07-27 11:13:05 -04:00
parent b9594e48fa
commit c215134fbe
4 changed files with 20 additions and 4 deletions

View File

@ -1,3 +1,10 @@
Version 1.50b:
--------------
- abort() instead of exit() in several places.
- Cleaned up mem leak, incorrect use of ck_free() in IDN handling.
Version 1.49b:
--------------

View File

@ -76,7 +76,7 @@ static inline void* __DFL_ck_realloc(void* orig, u32 size) {
}
if (orig) {
if (ALLOC_C(orig) != ALLOC_MAGIC) FATAL("Bad alloc canary");
if (ALLOC_C(orig) != ALLOC_MAGIC) ABORT("Bad alloc canary");
old_size = ALLOC_S(orig);
orig -= 6;
}
@ -138,7 +138,7 @@ static inline void* __DFL_ck_memdup(u8* mem, u32 size) {
static inline void __DFL_ck_free(void* mem) {
if (mem) {
if (ALLOC_C(mem) != ALLOC_MAGIC) FATAL("Bad alloc canary");
if (ALLOC_C(mem) != ALLOC_MAGIC) ABORT("Bad alloc canary");
free(mem - 6);
}
}

View File

@ -86,6 +86,13 @@
exit(1); \
} while (0)
#define ABORT(x...) do { \
F_DEBUG(cLRD "[-] PROGRAM ABORT : " cBRI x); \
F_DEBUG(cLRD "\n Stop location : " cNOR "%s(), %s:%u\n" cRST, \
__FUNCTION__, __FILE__, __LINE__); \
abort(); \
} while (0)
#define PFATAL(x...) do { \
F_DEBUG(cLRD "[-] SYSTEM ERROR : " cBRI x); \
F_DEBUG(cLRD "\n Stop location : " cNOR "%s(), %s:%u\n", \

View File

@ -267,6 +267,7 @@ u8 parse_url(u8* url, struct http_request* req, struct http_request* ref) {
default:
/* Uh-oh, invalid characters in a host name - abandon ship. */
ck_free(host);
return 1;
}
@ -284,12 +285,13 @@ u8 parse_url(u8* url, struct http_request* req, struct http_request* ref) {
if (idna_to_ascii_8z((char*)host, &output, 0) != IDNA_SUCCESS ||
strlen(output) > MAX_DNS_LEN) {
ck_free(output);
free(output);
return 1;
}
ck_free(host);
host = (u8*)output;
host = ck_strdup((u8*)output);
free(output);
}