Message ID | 20191016163401.16980-5-shiju.jose@huawei.com (mailing list archive) |
---|---|
State | Accepted |
Headers | show |
Series | rasdaemon: add fixes, database closure and signal handling | expand |
diff --git a/ras-events.c b/ras-events.c index fc6b288..f912dae 100644 --- a/ras-events.c +++ b/ras-events.c @@ -688,6 +688,7 @@ static int add_event_handler(struct ras_events *ras, struct pevent *pevent, /* Enable RAS events */ rc = __toggle_ras_mc_event(ras, group, event, 1); + free(page); if (rc < 0) { log(TERM, LOG_ERR, "Can't enable %s:%s tracing\n", group, event); @@ -697,7 +698,6 @@ static int add_event_handler(struct ras_events *ras, struct pevent *pevent, log(ALL, LOG_INFO, "Enabled event %s:%s\n", group, event); - free(page); return 0; }
This patch rearranges the free(page) call to prevent the memory leak when __toggle_ras_mc_event() fail. Signed-off-by: Shiju Jose <shiju.jose@huawei.com> --- ras-events.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)