detect: add new_de_ctx release in case of errors in initialization

Detect engine tenant reloading function hasn't got engine release call
under error label, so it is possible memory leak in case of errors in
further new detect engine initialization.

Bug: #7303
pull/11905/head
Zemeteri Kamimizu 5 months ago committed by Victor Julien
parent 6ae5ae701b
commit adcac9ee0f

@ -3931,12 +3931,12 @@ static int DetectEngineMultiTenantReloadTenant(uint32_t tenant_id, const char *f
new_de_ctx->tenant_path = SCStrdup(filename);
if (new_de_ctx->tenant_path == NULL) {
SCLogError("Failed to duplicate path");
goto error;
goto new_de_ctx_error;
}
if (SigLoadSignatures(new_de_ctx, NULL, false) < 0) {
SCLogError("Loading signatures failed.");
goto error;
goto new_de_ctx_error;
}
DetectEngineAddToMaster(new_de_ctx);
@ -3946,6 +3946,9 @@ static int DetectEngineMultiTenantReloadTenant(uint32_t tenant_id, const char *f
DetectEngineDeReference(&old_de_ctx);
return 0;
new_de_ctx_error:
DetectEngineCtxFree(new_de_ctx);
error:
DetectEngineDeReference(&old_de_ctx);
return -1;

Loading…
Cancel
Save