[wasm] [trap handler] do not leak memory on failure path

There were two failure paths where the CodeProtectionInfo object would not be
freed. This adds a free() on those paths to prevent a memory leak.

Bug: v8:7434
Change-Id: I48d60aee3255d829bf39b51cc30fabaf76b1fb07
Reviewed-on: https://chromium-review.googlesource.com/927746
Reviewed-by: Brad Nelson <bradnelson@chromium.org>
Commit-Queue: Eric Holk <eholk@chromium.org>
Cr-Commit-Position: refs/heads/master@{#51408}
This commit is contained in:
Eric Holk 2018-02-20 15:34:43 -08:00 committed by Commit Bot
parent d58d1fa72e
commit ef8dae3f3d

View File

@ -181,6 +181,7 @@ int RegisterHandlerData(
new_size = int_max;
}
if (new_size == gNumCodeObjects) {
free(data);
return kInvalidIndex;
}
@ -215,6 +216,7 @@ int RegisterHandlerData(
return static_cast<int>(i);
} else {
free(data);
return kInvalidIndex;
}
}