PPDCache: fix segfault due to access after delete
Regression introduced in: commit afe4d252 Author: Noel Grandin <noel.grandin@collabora.co.uk> Date: Wed Oct 18 09:43:21 2017 +0200 use std::unique_ptr in PPDCache Removing a naked pointer before inserting a possibly existing one in a container is safe. This insured uniqueness (as the comment suggests). However with unique_ptr, removal before inserting deletes the pointer (when it exists), and the insertion now taints the container with a wild pointer. The fix is to skip adding if the pointer is already in the container and add only when missing. Change-Id: Ifc6b517451abb564949ccadfee10d98bf827540d Reviewed-on: https://gerrit.libreoffice.org/44333Tested-by:Jenkins <ci@libreoffice.org> Reviewed-by:
Ashod Nakashian <ashnakash@gmail.com>
Showing
Please
register
or
sign in
to comment