summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSamuel Ortiz <sameo@linux.intel.com>2013-11-05 00:26:14 +0100
committerSamuel Ortiz <sameo@linux.intel.com>2013-11-05 00:26:14 +0100
commit2673654f7bcbf9ca365e1485682019924427c5f5 (patch)
treea7f491353bb27bb973a6447b091132fc08b0ff01
parentb2e1b68046b472d545dea570f7be9fa25dabbd20 (diff)
downloadneard-2673654f7bcbf9ca365e1485682019924427c5f5.tar.gz
neard-2673654f7bcbf9ca365e1485682019924427c5f5.tar.bz2
neard-2673654f7bcbf9ca365e1485682019924427c5f5.zip
tag: Do not unref a NULL write message
After successfully writing a tag, the next read might fail in which case tag_read_cb may be called several times. The pending write_msg pointer needs to be unrefed only once.
-rw-r--r--src/tag.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/tag.c b/src/tag.c
index fbc71c3..1d07f8b 100644
--- a/src/tag.c
+++ b/src/tag.c
@@ -284,8 +284,10 @@ static void tag_read_cb(uint32_t adapter_idx, uint32_t target_idx, int status)
if (!tag)
return;
- dbus_message_unref(tag->write_msg);
- tag->write_msg = NULL;
+ if (tag->write_msg) {
+ dbus_message_unref(tag->write_msg);
+ tag->write_msg = NULL;
+ }
__near_adapter_start_check_presence(adapter_idx, target_idx);