Skip to content

Commit

Permalink
[Skia] Fix double-free in WebKitTestRunner
Browse files Browse the repository at this point in the history
https://bugs.webkit.org/show_bug.cgi?id=270585

Reviewed by Carlos Garcia Campos and Adrian Perez de Castro.

sk_sp::get() returns a raw pointer without increasing
the reference count. To preserve semantics we need
to explicitly increase it when returning the snapshot,
otherwise we risk a double-free.

* Tools/wpe/backends/fdo/HeadlessViewBackendFdo.cpp:
(WPEToolingBackends::HeadlessViewBackend::snapshot):

Canonical link: https://commits.webkit.org/275784@main
  • Loading branch information
csaavedra committed Mar 7, 2024
1 parent e03b577 commit 669cd08
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion Tools/wpe/backends/fdo/HeadlessViewBackendFdo.cpp
Expand Up @@ -165,7 +165,7 @@ PlatformImage HeadlessViewBackend::snapshot()
#if defined(USE_CAIRO) && USE_CAIRO
return cairo_surface_reference(m_snapshot);
#elif defined(USE_SKIA) && USE_SKIA
return m_snapshot.get();
return SkRef(m_snapshot.get());
#endif
}

Expand Down

0 comments on commit 669cd08

Please sign in to comment.