summaryrefslogtreecommitdiffstats
path: root/src/account
diff options
context:
space:
mode:
authorTomas Bzatek <tbzatek@redhat.com>2013-11-28 12:14:59 +0100
committerTomas Bzatek <tbzatek@redhat.com>2013-11-28 12:14:59 +0100
commit35847aa0b11566154f0db5e2ef3673bccb138211 (patch)
treedc8ceb68b2a750239e198eb77d66bab643f4b75e /src/account
parent920ca0fe6f6c92870b9e604030219d06f3d3f616 (diff)
downloadopenlmi-providers-35847aa0b11566154f0db5e2ef3673bccb138211.tar.gz
openlmi-providers-35847aa0b11566154f0db5e2ef3673bccb138211.tar.xz
openlmi-providers-35847aa0b11566154f0db5e2ef3673bccb138211.zip
account: Free private indication data after indications are stopped
...to prevent race of the watcher thread still using data that has been freed just a moment ago.
Diffstat (limited to 'src/account')
-rw-r--r--src/account/LMI_AccountInstanceCreationIndicationProvider.c8
-rw-r--r--src/account/LMI_AccountInstanceDeletionIndicationProvider.c8
2 files changed, 10 insertions, 6 deletions
diff --git a/src/account/LMI_AccountInstanceCreationIndicationProvider.c b/src/account/LMI_AccountInstanceCreationIndicationProvider.c
index 989eaae..cc52fa1 100644
--- a/src/account/LMI_AccountInstanceCreationIndicationProvider.c
+++ b/src/account/LMI_AccountInstanceCreationIndicationProvider.c
@@ -115,8 +115,10 @@ static CMPIStatus LMI_AccountInstanceCreationIndicationEnableIndications(
CMPIIndicationMI* mi,
const CMPIContext* cc)
{
- if (!watcher_init(&ai) ||
- !im_start_ind(im, cc, &im_err)) {
+ if (!watcher_init(&ai))
+ CMReturn(CMPI_RC_ERR_FAILED);
+ if (!im_start_ind(im, cc, &im_err)) {
+ watcher_destroy(&ai);
CMReturn(CMPI_RC_ERR_FAILED);
}
CMReturn(CMPI_RC_OK);
@@ -126,10 +128,10 @@ static CMPIStatus LMI_AccountInstanceCreationIndicationDisableIndications(
CMPIIndicationMI* mi,
const CMPIContext* cc)
{
- watcher_destroy(&ai);
if (!im_stop_ind(im, cc, &im_err)) {
CMReturn(CMPI_RC_ERR_FAILED);
}
+ watcher_destroy(&ai);
CMReturn(CMPI_RC_OK);
}
diff --git a/src/account/LMI_AccountInstanceDeletionIndicationProvider.c b/src/account/LMI_AccountInstanceDeletionIndicationProvider.c
index ee86e6e..3f384e7 100644
--- a/src/account/LMI_AccountInstanceDeletionIndicationProvider.c
+++ b/src/account/LMI_AccountInstanceDeletionIndicationProvider.c
@@ -118,8 +118,10 @@ static CMPIStatus LMI_AccountInstanceDeletionIndicationEnableIndications(
CMPIIndicationMI* mi,
const CMPIContext* cc)
{
- if (!watcher_init(&ai) ||
- !im_start_ind(im, cc, &im_err)) {
+ if (!watcher_init(&ai))
+ CMReturn(CMPI_RC_ERR_FAILED);
+ if (!im_start_ind(im, cc, &im_err)) {
+ watcher_destroy(&ai);
CMReturn(CMPI_RC_ERR_FAILED);
}
CMReturn(CMPI_RC_OK);
@@ -129,10 +131,10 @@ static CMPIStatus LMI_AccountInstanceDeletionIndicationDisableIndications(
CMPIIndicationMI* mi,
const CMPIContext* cc)
{
- watcher_destroy(&ai);
if (!im_stop_ind(im, cc, &im_err)) {
CMReturn(CMPI_RC_ERR_FAILED);
}
+ watcher_destroy(&ai);
CMReturn(CMPI_RC_OK);
}