[Debian-iot-packaging] [openzwave-controlpanel] 24/81: Fix memory corruption in values with new value removed notifications. Fix testusb harness.

Dara Adib daradib-guest at moszumanska.debian.org
Thu Dec 22 16:57:47 UTC 2016


This is an automated email from the git hooks/post-receive script.

daradib-guest pushed a commit to branch debian/master
in repository openzwave-controlpanel.

commit 811ae42cc6e3ed09c41428bcbd2a2760a430ad17
Author: glsatz <glsatz at gmail.com>
Date:   Tue Feb 14 07:45:22 2012 +0000

    Fix memory corruption in values with new value removed notifications.
    Fix testusb harness.
---
 Makefile   |  2 +-
 ozwcp.cpp  | 13 +++++++++++--
 ozwcp.h    |  2 +-
 testusb.sh |  8 ++++----
 4 files changed, 17 insertions(+), 8 deletions(-)

diff --git a/Makefile b/Makefile
index 0143daa..6069419 100644
--- a/Makefile
+++ b/Makefile
@@ -12,7 +12,7 @@ LD     := g++
 AR     := ar rc
 RANLIB := ranlib
 
-DEBUG_CFLAGS    := -Wall -Wno-format -g -DDEBUG -Werror
+DEBUG_CFLAGS    := -Wall -Wno-inline -Wno-format -g -DDEBUG -Werror
 RELEASE_CFLAGS  := -Wall -Wno-unknown-pragmas -Wno-format -O3 -DNDEBUG
 
 DEBUG_LDFLAGS	:= -g
diff --git a/ozwcp.cpp b/ozwcp.cpp
index bf862a8..f6a3244 100644
--- a/ozwcp.cpp
+++ b/ozwcp.cpp
@@ -161,13 +161,22 @@ void MyNode::addValue (ValueID id)
  */
 void MyNode::removeValue (ValueID id)
 {
-  for (vector<MyValue*>::iterator it = values.begin(); it != values.end(); it++) {
+  vector<MyValue*>::iterator it;
+  bool found = false;
+  for (it = values.begin(); it != values.end(); it++) {
     if ((*it)->id == id) {
-      values.erase(it);
       delete *it;
+      values.erase(it);
+      found = true;
       break;
     }
   }
+  if (!found)
+    fprintf(stderr, "removeValue not found Home 0x%08x Node %d Genre %s Class %s Instance %d Index %d Type %s\n",
+	    id.GetHomeId(), id.GetNodeId(), valueGenreStr(id.GetGenre()),
+	    cclassStr(id.GetCommandClassId()), id.GetInstance(), id.GetIndex(),
+	    valueTypeStr(id.GetType()));
+
   setChanged(true);
   setTime(time(NULL));
 }
diff --git a/ozwcp.h b/ozwcp.h
index c272145..079570a 100644
--- a/ozwcp.h
+++ b/ozwcp.h
@@ -112,6 +112,6 @@ private:
   bool changed;
   static bool nodechanged;
   static list<uint8> removed;
-  vector <MyGroup*> groups;
+  vector<MyGroup*> groups;
   vector<MyValue*> values;
 };
diff --git a/testusb.sh b/testusb.sh
index 17eca89..286bed6 100755
--- a/testusb.sh
+++ b/testusb.sh
@@ -9,11 +9,11 @@ for (( i = 1 ; i <= 10 ; i = i + 1 )) ; do
   wget -r -l 1 -O /dev/null -o /dev/null $host
   sleep 1
   echo open
-  wget -O /dev/null -o /dev/null --post-data="fn=open&usb=true" '$1'/devpost.html?dev=&fn=open&usb=true'
+  wget -O /dev/null -o /dev/null --post-data="fn=open&usb=true" $1'/devpost.html?dev=&fn=open&usb=true'
   wget -O /dev/null -o /dev/null $host
   j=20
   while [ $j -gt 0 ]; do
-    wget -O /tmp/poll.xml -o /dev/null '$1'/poll.xml'
+    wget -O /tmp/poll.xml -o /dev/null $1'/poll.xml'
     if ( test -s /tmp/poll.xml && grep 'log size="0"' /tmp/poll.xml > /dev/null 2>&1 ) ; then
       let j--
     else
@@ -21,8 +21,8 @@ for (( i = 1 ; i <= 10 ; i = i + 1 )) ; do
     fi
   done
   echo close
-  wget -O /dev/null -o /dev/null --post-data="fn=close&usb=true" '$1'/devpost.html?dev=&fn=close&usb=true'
+  wget -O /dev/null -o /dev/null --post-data="fn=close&usb=true" $1'/devpost.html?dev=&fn=close&usb=true'
   wget -O /dev/null -o /dev/null $host
 done
 echo exit
-wget -O /dev/null -o /dev/null --post-data="fn=exit" '$1'/devpost.html?dev=&fn=exit'
+wget -O /dev/null -o /dev/null --post-data="fn=exit" $1'/devpost.html?dev=&fn=exit'

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-iot/openzwave-controlpanel.git



More information about the Debian-iot-packaging mailing list