Fix memory leak from auparse_get_node
This commit is contained in:
parent
62adea5afd
commit
972da5776a
@ -229,7 +229,7 @@ void auparse_callback(auparse_state_t *au, auparse_cb_event_t cb_event_type, voi
|
||||
audit_record.time = auparse_get_time(au);
|
||||
audit_record.milliseconds = auparse_get_milli(au);
|
||||
audit_record.serial = auparse_get_serial(au);
|
||||
audit_record.node = string_or_null(auparse_get_node(au));
|
||||
audit_record.node = string_or_null_and_free(auparse_get_node(au));
|
||||
|
||||
if (auparse_first_field(au) > 0)
|
||||
{
|
||||
|
@ -20,11 +20,20 @@
|
||||
|
||||
#include "utils.hpp"
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
std::string string_or_null(const char *data)
|
||||
{
|
||||
return (data) ? data : std::string();
|
||||
}
|
||||
|
||||
std::string string_or_null_and_free(const char *data)
|
||||
{
|
||||
std::string result = string_or_null(data);
|
||||
free((void*) data);
|
||||
return result;
|
||||
}
|
||||
|
||||
std::string sanitize_column_name(const std::string &name)
|
||||
{
|
||||
auto result = name;
|
||||
|
Loading…
Reference in New Issue
Block a user