pike.git / src / post_modules / Shuffler / a_source_system_memory.c

version» Context lines:

pike.git/src/post_modules/Shuffler/a_source_system_memory.c:1:   #include "global.h"   #include "bignum.h"   #include "object.h"   #include "interpret.h"      #include <shuffler.h>    - /* $Id: a_source_system_memory.c,v 1.2 2002/05/29 05:47:12 per Exp $ */ + /* $Id: a_source_system_memory.c,v 1.3 2002/05/29 07:39:51 per Exp $ */    -  + /* Source: System.Memory +  * Argument: An initialized instance of the System.Memory class +  */   static struct program *shm_program;      struct sm_source   {    struct source s;       struct object *obj;    struct {    unsigned char *data;    size_t len;
pike.git/src/post_modules/Shuffler/a_source_system_memory.c:61:       res = malloc( sizeof( struct sm_source ) );    MEMSET( res, 0, sizeof( struct sm_source ) );       if( !(res->mem = (void*)get_storage( s->u.object, shm_program ) ) )    {    free(res);    return 0;    }    +  if( !res->mem->data || !res->mem->len ) +  { +  free(res); +  return 0; +  } +     res->s.free = free_source;    res->s.get_data = get_data;    res->obj = s->u.object;    res->obj->refs++;    res->offset = start;       if( len != -1 )    if( len > res->mem->len-start )    {    res->obj->refs--;