Browse Source

Fix memory leak for notifications feature

Add log_info_clear() to cancel out log_info_call() from call_get*().
pull/225/head
Stefan Mititelu 10 years ago
parent
commit
bd7abe6409
2 changed files with 7 additions and 4 deletions
  1. +5
    -3
      daemon/cli.c
  2. +2
    -1
      daemon/redis.c

+ 5
- 3
daemon/cli.c View File

@ -11,6 +11,7 @@
#include "poller.h"
#include "aux.h"
#include "log.h"
#include "log_funcs.h"
#include "call.h"
#include "cli.h"
#include "socket.h"
@ -49,11 +50,11 @@ static void destroy_own_foreign_calls(struct callmaster *m, unsigned int foreign
continue;
}
// save call reference
g_queue_push_tail(&call_list, obj_get(c));
// increase ref counter
obj_get(c);
// save call reference
g_queue_push_tail(&call_list, c);
}
// unlock read
@ -889,6 +890,7 @@ next:
cleanup:
close(nfd);
mutex_unlock(&cli->lock);
log_info_clear();
}
static void control_closed(int fd, void *p, uintptr_t u) {


+ 2
- 1
daemon/redis.c View File

@ -13,6 +13,7 @@
#include "aux.h"
#include "call.h"
#include "log.h"
#include "log_funcs.h"
#include "str.h"
#include "crypto.h"
#include "dtls.h"
@ -20,7 +21,6 @@
#include "hiredis/async.h"
#include "hiredis/adapters/libevent.h"
#include "event2/thread.h"
#include "log_funcs.h"
@ -343,6 +343,7 @@ err:
if (c) {
// because of call_get(..)
obj_put(c);
log_info_clear();
}
mutex_unlock(&r->lock);


Loading…
Cancel
Save