diff options
author | Oliver Sander <oliver.sander@tu-dresden.de> | 2019-11-26 17:02:56 +0100 |
---|---|---|
committer | Albert Astals Cid <tsdgeos@yahoo.es> | 2020-02-26 21:35:54 +0000 |
commit | 58dfc767964f133f9bf18b3c5eb641c090584967 (patch) | |
tree | f513881de7fd1e3769758956ccb40dd39704d1ec /glib | |
parent | 35b7e926035c7d6852ed148b4dbe6d15e32f3fed (diff) |
Handle LinkAction objects by std::unique_ptrs
This clarifies the object ownership, and fixes various memory leaks.
Diffstat (limited to 'glib')
-rw-r--r-- | glib/poppler-form-field.cc | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/glib/poppler-form-field.cc b/glib/poppler-form-field.cc index 0507d4e8..b7d51e56 100644 --- a/glib/poppler-form-field.cc +++ b/glib/poppler-form-field.cc @@ -2,6 +2,7 @@ * * Copyright (C) 2007 Carlos Garcia Campos <carlosgc@gnome.org> * Copyright (C) 2006 Julien Rebetez + * Copyright (C) 2020 Oliver Sander <oliver.sander@tu-dresden.de> * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -18,6 +19,8 @@ * Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ +#include <memory> + #include "poppler.h" #include "poppler-private.h" @@ -215,7 +218,6 @@ poppler_form_field_get_additional_action (PopplerFormField *field, PopplerAdditionalActionType type) { Annot::FormAdditionalActionsType form_action; - LinkAction *link_action; PopplerAction **action; switch (type) @@ -244,11 +246,11 @@ poppler_form_field_get_additional_action (PopplerFormField *field, if (*action) return *action; - link_action = field->widget->getAdditionalAction (form_action); + std::unique_ptr<LinkAction> link_action = field->widget->getAdditionalAction (form_action); if (!link_action) return nullptr; - *action = _poppler_action_new (nullptr, link_action, nullptr); + *action = _poppler_action_new (nullptr, link_action.get(), nullptr); return *action; } |