Compare commits

..

No commits in common. "master" and "fix-duplicate-leak" have entirely different histories.

3 changed files with 7 additions and 11 deletions

View File

@ -184,8 +184,6 @@ HashMapDelete(HashMap * map, const char *key)
if (bucket->hash == hash) if (bucket->hash == hash)
{ {
bucket->hash = 0; bucket->hash = 0;
Free(bucket->key);
bucket->key = NULL;
return bucket->value; return bucket->value;
} }

View File

@ -40,12 +40,10 @@
#define MEMORY_HEXDUMP_WIDTH 16 #define MEMORY_HEXDUMP_WIDTH 16
#endif #endif
#define MEMORY_FILE_SIZE 256
struct MemoryInfo struct MemoryInfo
{ {
size_t size; size_t size;
char file[MEMORY_FILE_SIZE]; const char *file;
int line; int line;
void *pointer; void *pointer;
}; };
@ -229,7 +227,7 @@ MemoryAllocate(size_t size, const char *file, int line)
MEM_BOUND_UPPER(p, size) = MEM_BOUND; MEM_BOUND_UPPER(p, size) = MEM_BOUND;
a->size = MEM_SIZE_ACTUAL(size); a->size = MEM_SIZE_ACTUAL(size);
strncpy(a->file, file, MEMORY_FILE_SIZE - 1); a->file = file;
a->line = line; a->line = line;
a->pointer = p; a->pointer = p;
@ -272,7 +270,7 @@ MemoryReallocate(void *p, size_t size, const char *file, int line)
{ {
MemoryDelete(a); MemoryDelete(a);
a->size = MEM_SIZE_ACTUAL(size); a->size = MEM_SIZE_ACTUAL(size);
strncpy(a->file, file, MEMORY_FILE_SIZE - 1); a->file = file;
a->line = line; a->line = line;
a->pointer = new; a->pointer = new;
@ -295,7 +293,7 @@ MemoryReallocate(void *p, size_t size, const char *file, int line)
if (a) if (a)
{ {
a->size = 0; a->size = 0;
strncpy(a->file, file, MEMORY_FILE_SIZE - 1); a->file = file;
a->line = line; a->line = line;
a->pointer = p; a->pointer = p;
hook(MEMORY_BAD_POINTER, a, hookArgs); hook(MEMORY_BAD_POINTER, a, hookArgs);
@ -324,7 +322,7 @@ MemoryFree(void *p, const char *file, int line)
pthread_mutex_lock(&lock); pthread_mutex_lock(&lock);
if (hook) if (hook)
{ {
strncpy(a->file, file, MEMORY_FILE_SIZE - 1); a->file = file;
a->line = line; a->line = line;
hook(MEMORY_FREE, a, hookArgs); hook(MEMORY_FREE, a, hookArgs);
} }
@ -339,7 +337,7 @@ MemoryFree(void *p, const char *file, int line)
a = malloc(sizeof(MemoryInfo)); a = malloc(sizeof(MemoryInfo));
if (a) if (a)
{ {
strncpy(a->file, file, MEMORY_FILE_SIZE - 1); a->file = file;
a->line = line; a->line = line;
a->size = 0; a->size = 0;
a->pointer = p; a->pointer = p;

View File

@ -81,7 +81,7 @@ TlsInitClient(int fd, const char *serverName)
cookie->method = TLS_client_method(); cookie->method = TLS_client_method();
cookie->ctx = SSL_CTX_new(cookie->method); cookie->ctx = SSL_CTX_new(cookie->method);
cookie->fd = fd; coolie->fd = fd;
if (!cookie->ctx) if (!cookie->ctx)
{ {
goto error; goto error;