Revision: 7065
          http://playerstage.svn.sourceforge.net/playerstage/?rev=7065&view=rev
Author:   gbiggs
Date:     2008-10-06 01:31:46 +0000 (Mon, 06 Oct 2008)

Log Message:
-----------
Applied patch 2147885

Modified Paths:
--------------
    code/player/trunk/server/drivers/localization/fakelocalize.cc

Modified: code/player/trunk/server/drivers/localization/fakelocalize.cc
===================================================================
--- code/player/trunk/server/drivers/localization/fakelocalize.cc       
2008-10-06 01:23:34 UTC (rev 7064)
+++ code/player/trunk/server/drivers/localization/fakelocalize.cc       
2008-10-06 01:31:46 UTC (rev 7065)
@@ -143,7 +143,8 @@
 
////////////////////////////////////////////////////////////////////////////////
 // Constructor
 FakeLocalize::FakeLocalize( ConfigFile* cf, int section)
-  : Driver(cf, section, true, PLAYER_MSGQUEUE_DEFAULT_MAXLEN)
+  : Driver(cf, section, true, PLAYER_MSGQUEUE_DEFAULT_MAXLEN),
+  model (NULL)
 {
   // Must have an input sim
   if (cf->ReadDeviceAddr(&this->sim_id, section, "requires",
@@ -182,19 +183,28 @@
     return;
   }
 
-  if(!(this->model = strdup(cf->ReadString(section, "model", NULL))))
+  const char * str = cf->ReadString(section, "model", NULL);
+  if(str == NULL)
   {
     PLAYER_ERROR("must specify non-NULL model name");
     this->SetError(-1);
     return;
   }
+  this->model = strdup(str);
+  if (this->model == NULL)
+  {
+    PLAYER_ERROR("failed to duplicate model string");
+    this->SetError(-1);
+    return;
+  }
 
   return;
 }
 
 FakeLocalize::~FakeLocalize()
 {
-  free(this->model);
+  if(this->model != NULL)
+    free(this->model);
 }
 
 
////////////////////////////////////////////////////////////////////////////////


This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Playerstage-commit mailing list
Playerstage-commit@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/playerstage-commit

Reply via email to