Skip to content

Commit

Permalink
Merge pull request #87 from yast/callback-crash
Browse files Browse the repository at this point in the history
Do not crash after a callback is set, unset, then called
  • Loading branch information
mvidner committed Oct 23, 2017
2 parents e35fba2 + a936486 commit 649b990
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 5 deletions.
2 changes: 1 addition & 1 deletion package/yast2-pkg-bindings-devel-doc.spec
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
#

Name: yast2-pkg-bindings-devel-doc
Version: 4.0.1
Version: 4.0.2
Release: 0
License: GPL-2.0
Group: Documentation/HTML
Expand Down
7 changes: 7 additions & 0 deletions package/yast2-pkg-bindings.changes
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
-------------------------------------------------------------------
Mon Oct 23 11:57:37 UTC 2017 - mvidner@suse.com

- Do not crash after a callback is set, unset, then called
(bsc#1063459)
- 4.0.2

-------------------------------------------------------------------
Mon Sep 25 10:30:05 UTC 2017 - igonzalezsosa@suse.com

Expand Down
2 changes: 1 addition & 1 deletion package/yast2-pkg-bindings.spec
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@


Name: yast2-pkg-bindings
Version: 4.0.1
Version: 4.0.2
Release: 0

BuildRoot: %{_tmppath}/%{name}-%{version}-build
Expand Down
12 changes: 9 additions & 3 deletions src/Callbacks.YCP.cc
Original file line number Diff line number Diff line change
Expand Up @@ -189,15 +189,21 @@
const _cbdata_t::const_iterator tmp1 = _cbdata.find(id_r);

if (tmp1 == _cbdata.end())
{
y2debug ("Callback %s not found", cbName(id_r).c_str());
return NULL;
}
if (tmp1->second.empty())
{
y2debug ("Callback %s is empty", cbName(id_r).c_str());
return NULL;
}

const YCPReference func(tmp1->second.top());

if (func.isNull() || ! func->isReference())
{
// TODO
// ycp2error ("Unexpected function pointer: %s"
// , ptr.isNull () ? "NULL" : ptr->toString ().c_str ());
y2debug ("Callback %s is not a func reference", cbName(id_r).c_str());
return NULL;
}

Expand Down

0 comments on commit 649b990

Please sign in to comment.