fixed memleak in trans_logger

This commit is contained in:
Thomas Schoebel-Theuer 2012-02-02 16:36:57 +01:00 committed by Thomas Schoebel-Theuer
parent 91f262b72b
commit fa6f0a6cf5
2 changed files with 17 additions and 2 deletions

View File

@ -6,6 +6,11 @@
#include "lib_log.h"
//#define BRICK_DEBUGGING
//#define MARS_DEBUGGING
//#define IO_DEBUGGING
bool is_log_ready(struct log_status *logst)
{
return logst->max_flying <= 0 ||
@ -22,6 +27,16 @@ void exit_logst(struct log_status *logst)
MARS_DBG("waiting for IO terminating...");
msleep(500);
}
if (logst->read_mref) {
MARS_DBG("putting read_mref\n");
GENERIC_INPUT_CALL(logst->input, mref_put, logst->read_mref);
logst->read_mref = NULL;
}
if (logst->log_mref) {
MARS_DBG("putting log_mref\n");
GENERIC_INPUT_CALL(logst->input, mref_put, logst->log_mref);
logst->log_mref = NULL;
}
}
EXPORT_SYMBOL_GPL(exit_logst);

View File

@ -1975,8 +1975,8 @@ void _exit_inputs(struct trans_logger_brick *brick, bool force)
for (i = TL_INPUT_LOG1; i <= TL_INPUT_LOG2; i++) {
struct trans_logger_input *input = brick->inputs[i];
struct log_status *logst = &input->logst;
if (input->is_operating &&
(force || !input->connect)) {
if (force ||
(input->is_operating &&!input->connect)) {
MARS_DBG("cleaning up input %d (log = %d old = %d)\n", i, brick->log_input_nr, brick->old_input_nr);
exit_logst(logst);
input->is_operating = false;