rem: if (p>(void*)qm->last_frag_end || p<(void*)qm->first_frag){
add: if ((p)&&(p>(void*)qm->last_frag_end || p<(void*)qm->first_frag)){
context: void* qm_realloc(struct qm_block* qm, void* p, unsigned int size)#endif{	struct qm_frag* f;	unsigned int diff;	unsigned int orig_size;	struct qm_frag* n;	void* ptr;		#ifdef DBG_QM_MALLOC	DBG("qm_realloc(%p, %p, %d) called from %s: %s(%d)\n", qm, p, size,			file, func, line);	if (p>(void*)qm->last_frag_end || p<(void*)qm->first_frag){		LOG(L_CRIT, "BUG: qm_free: bad pointer %p (out of memory block!) - "				"aborting\n", p);		abort();	}#endif		if (size==0) {		if (p)#ifdef DBG_QM_MALLOC			qm_free(qm, p, file, func, line);#else			qm_free(qm, p);#endif		return 0;	}	if (p==0)#ifdef DBG_QM_MALLOC		return qm_malloc(qm, size, file, func, line);#else		return qm_malloc(qm, size);#endif	f=(struct qm_frag*) ((char*)p-sizeof(struct qm_frag));#ifdef DBG_QM_MALLOC	qm_debug_frag(qm, f);	DBG("qm_realloc: realloc'ing frag %p alloc'ed from %s: %s(%ld)\n",			f, f->file, f->func, f->line);	if (f->u.is_free){		LOG(L_CRIT, "BUG:qm_realloc: trying to realloc an already freed "				"pointer %p , fragment %p -- aborting\n", p, f);		abort();	}#endif	/* find first acceptable size */	size=ROUNDUP(size);	if (f->size > size){		/* shrink */#ifdef DBG_QM_MALLOC		DBG("qm_realloc: shrinking from %ld to %d\n", f->size, size);		if(split_frag(qm, f, size, file, "fragm. from qm_realloc", line)!=0){		DBG("qm_realloc : shrinked succesfull\n");#else		if(split_frag(qm, f, size)!=0){#endif			/* update used sizes */			qm->real_used-=(f->size-size);			qm->used-=(f->size-size);		}			}else if (f->size < size){		/* grow */#ifdef DBG_QM_MALLOC		DBG("qm_realloc: growing from %ld to %d\n", f->size, size);#endif			orig_size=f->size;			diff=size-f->size;			n=FRAG_NEXT(f);			if (((char*)n < (char*)qm->last_frag_end) && 					(n->u.is_free)&&((n->size+FRAG_OVERHEAD)>=diff)){				/* join  */				qm_detach_free(qm, n);				f->size+=n->size+FRAG_OVERHEAD;				qm->real_used-=FRAG_OVERHEAD;				FRAG_END(f)->size=f->size;				/* end checks should be ok */				/* split it if necessary */				if (f->size > size ){	#ifdef DBG_QM_MALLOC					split_frag(qm, f, size, file, "fragm. from qm_realloc",										line);	#else					split_frag(qm, f, size);	#endif				}				qm->real_used+=(f->size-orig_size);				qm->used+=(f->size-orig_size);			}else{				/* could not join => realloc */	#ifdef DBG_QM_MALLOC				ptr=qm_malloc(qm, size, file, func, line);	#else				ptr=qm_malloc(qm, size);	#endif				if (ptr)					/* copy, need by libssl */					memcpy(ptr, p, orig_size);	#ifdef DBG_QM_MALLOC					qm_free(qm, p, file, func, line);	#else					qm_free(qm, p);	#endif				p=ptr;			}	}else{		/* do nothing */#ifdef DBG_QM_MALLOC		DBG("qm_realloc: doing nothing, same size: %ld - %d\n", f->size, size);#endif	}#ifdef DBG_QM_MALLOC	DBG("qm_realloc: returning %p\n", p);#endif	return p;}