Răsfoiți Sursa

*** empty log message ***

David Rose 25 ani în urmă
părinte
comite
773da00dd4
1 a modificat fișierele cu 3 adăugiri și 1 ștergeri
  1. 3 1
      panda/src/express/datagramInputFile.cxx

+ 3 - 1
panda/src/express/datagramInputFile.cxx

@@ -56,16 +56,18 @@ get_datagram(Datagram &data) {
   PN_uint32 num_bytes = di.get_uint32();
   PN_uint32 num_bytes = di.get_uint32();
 
 
   // Now, read the datagram itself.
   // Now, read the datagram itself.
-  char *buffer = (char *)alloca(num_bytes);
+  char *buffer = new char[num_bytes];
   nassertr(buffer != (char *)NULL, false);
   nassertr(buffer != (char *)NULL, false);
 
 
   _in.read(buffer, num_bytes);
   _in.read(buffer, num_bytes);
   if (_in.fail() || _in.eof()) {
   if (_in.fail() || _in.eof()) {
     _error = true;
     _error = true;
+    delete[] buffer;
     return false;
     return false;
   }
   }
 
 
   data = Datagram(buffer, num_bytes);
   data = Datagram(buffer, num_bytes);
+  delete[] buffer;
   return true;
   return true;
 }
 }