Sfoglia il codice sorgente

*** empty log message ***

David Rose 25 anni fa
parent
commit
773da00dd4
1 ha cambiato i file con 3 aggiunte e 1 eliminazioni
  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();
 
   // Now, read the datagram itself.
-  char *buffer = (char *)alloca(num_bytes);
+  char *buffer = new char[num_bytes];
   nassertr(buffer != (char *)NULL, false);
 
   _in.read(buffer, num_bytes);
   if (_in.fail() || _in.eof()) {
     _error = true;
+    delete[] buffer;
     return false;
   }
 
   data = Datagram(buffer, num_bytes);
+  delete[] buffer;
   return true;
 }