src/physfs_archiver_7z.c
changeset 1691 c66c9326b05d
parent 1689 1dc6e265fefc
equal deleted inserted replaced
1689:1dc6e265fefc 1691:c66c9326b05d
   283 
   283 
   284     rc = SzArEx_Extract(&info->db, &stream.lookStream.s, entry->dbidx,
   284     rc = SzArEx_Extract(&info->db, &stream.lookStream.s, entry->dbidx,
   285                         &blockIndex, &outBuffer, &outBufferSize, &offset,
   285                         &blockIndex, &outBuffer, &outBufferSize, &offset,
   286                         &outSizeProcessed, alloc, alloc);
   286                         &outSizeProcessed, alloc, alloc);
   287     GOTO_IF(rc != SZ_OK, szipErrorCode(rc), SZIP_openRead_failed);
   287     GOTO_IF(rc != SZ_OK, szipErrorCode(rc), SZIP_openRead_failed);
       
   288     GOTO_IF(outBuffer == NULL, PHYSFS_ERR_OUT_OF_MEMORY, SZIP_openRead_failed);
   288 
   289 
   289     io->destroy(io);
   290     io->destroy(io);
   290     io = NULL;
   291     io = NULL;
   291 
   292 
   292     buf = allocator.Malloc(outSizeProcessed);
   293     buf = allocator.Malloc(outSizeProcessed ? outSizeProcessed : 1);
   293     GOTO_IF(buf == NULL, PHYSFS_ERR_OUT_OF_MEMORY, SZIP_openRead_failed);
   294     GOTO_IF(buf == NULL, PHYSFS_ERR_OUT_OF_MEMORY, SZIP_openRead_failed);
   294     memcpy(buf, outBuffer + offset, outSizeProcessed);
   295 
       
   296     if (outSizeProcessed > 0)
       
   297         memcpy(buf, outBuffer + offset, outSizeProcessed);
   295 
   298 
   296     alloc->Free(alloc, outBuffer);
   299     alloc->Free(alloc, outBuffer);
   297     outBuffer = NULL;
   300     outBuffer = NULL;
   298 
   301 
   299     retval = __PHYSFS_createMemoryIo(buf, outSizeProcessed, allocator.Free);
   302     retval = __PHYSFS_createMemoryIo(buf, outSizeProcessed, allocator.Free);