예제 #1
0
rpmioPool rpmioFreePool(rpmioPool pool)
	/*@globals _rpmioPool @*/
	/*@modifies _rpmioPool @*/
{
    if (pool == NULL) {
	pool = _rpmioPool;
	_rpmioPool = NULL;
    }
    if (pool != NULL) {
	rpmioItem item;
	int count = 0;
	yarnPossess(pool->have);
	while ((item = pool->head) != NULL) {
	    pool->head = item->pool;	/* XXX pool == next */
	    if (item->use != NULL)
		item->use = yarnFreeLock(item->use);
	    item = _free(item);
	    count++;
	}
	yarnRelease(pool->have);
	pool->have = yarnFreeLock(pool->have);
	rpmlog(RPMLOG_DEBUG, D_("pool %s:\treused %d, alloc'd %d, free'd %d items.\n"), pool->name, pool->reused, pool->made, count);
#ifdef	NOTYET
assert(pool->made == count);
#else
if (pool->made != count)
rpmlog(RPMLOG_WARNING, D_("pool %s: FIXME: made %d, count %d\nNote: This is a harmless memory leak discovered while exiting, relax ...\n"), pool->name, pool->made, count);
#endif
	(void) _free(pool);
	VALGRIND_DESTROY_MEMPOOL(pool);
    }
    return NULL;
}
예제 #2
0
static void rpmrubyFini(void * _ruby)
        /*@globals fileSystem @*/
        /*@modifies *_ruby, fileSystem @*/
{
    rpmruby ruby = _ruby;

    /* XXX FIXME: 0x40000000 => xruby.c wrapper without interpreter. */
    if (ruby->flags & 0x40000000) {
	ruby->main_coroutine_lock = yarnFreeLock(ruby->main_coroutine_lock);
	ruby->ruby_coroutine_lock = yarnFreeLock(ruby->ruby_coroutine_lock);
	ruby->zlog = rpmzLogDump(ruby->zlog, NULL);
	ruby->stack = _free(ruby->stack);
	ruby->nstack = 0;
	_rpmrubyI = NULL;
    } else {
#if defined(WITH_RUBYEMBED)
	ruby_finalize();
	ruby_cleanup(0);
#endif
    }
    ruby->I = NULL;
    ruby->flags = 0;
    ruby->av = argvFree(ruby->av);
    ruby->ac = 0;
}
예제 #3
0
rpmzLog rpmzLogFree(rpmzLog zlog)
{
    long nrefs;
    rpmzMsg me;

    if (zlog == NULL)
        return NULL;

    yarnPossess(zlog->_item.use);
    nrefs = yarnPeekLock(zlog->_item.use);
    if (_rpmzlog_debug)
        fprintf(stderr, "    -- zlog %p[%ld]\n", zlog, nrefs);
#ifdef  NOTYET
    assert(nrefs > 0);
#else
    if (nrefs <= 0)
        fprintf(stderr, "==> FIXME: %s: zlog %p[%ld]\n", __FUNCTION__, zlog, nrefs);
#endif
    if (nrefs == 1) {
        yarnLock use = zlog->_item.use;
        if (zlog->msg_tail != NULL) {
            while ((me = zlog->msg_head) != NULL) {
                zlog->msg_head = me->next;
                me->msg = _free(me->msg);
                /*@-compdestroy@*/
                me = _free(me);
                /*@=compdestroy@*/
                zlog->msg_count--;
            }
#ifdef  NOTYET
            assert(zlog->msg_count == 0);
#else
            if (zlog->msg_count != 0)
                fprintf(stderr, "==> FIXME: %s: zlog %p[%ld] count %d\n", __FUNCTION__, zlog, nrefs, zlog->msg_count);
#endif
            zlog->msg_count = 0;
            zlog->msg_tail = NULL;
        }
        zlog = _free(zlog);
        yarnTwist(use, BY, -1);
        use = yarnFreeLock(use);
    } else
        yarnTwist(zlog->_item.use, BY, -1);
    return NULL;
}
예제 #4
0
파일: verify.c 프로젝트: avokhmin/RPM5
static rpmvf rpmvfFree(/*@only@*/ rpmvf vf)
	/*@modifies vf @*/
{

    if (vf) {
#ifdef	NOTYET
	yarnPossess(vf->_item.use);
	if (yarnPeekLock(vf->_item.use) <= 1L) {
	    yarnLock use = vf->_item.use;
	    vf->fn = _free(vf->fn);
	    vf = _free(vf);
	    yarnTwist(use, TO, 0);
	    use = yarnFreeLock(use);
	} else
	    yarnTwist(vf->_item.use, BY, -1);
#else
	vf->fn = _free(vf->fn);
	vf = _free(vf);
#endif
    }
    return NULL;
}
예제 #5
0
/*@-internalglobs@*/
rpmioItem rpmioPutPool(rpmioItem item)
{
    rpmioPool pool;

    if ((pool = item->pool) != NULL) {
	yarnPossess(pool->have);
	item->pool = NULL;		/* XXX pool == next */
	*pool->tail = item;
	pool->tail = (void *)&item->pool;/* XXX pool == next */
	yarnTwist(pool->have, BY, 1);
	if (item->use != NULL)
	    yarnTwist(item->use, TO, 0);
	return NULL;
    }

    if (item->use != NULL) {
	yarnTwist(item->use, TO, 0);
	item->use = yarnFreeLock(item->use);
    }
    (void) _free(item);
    return NULL;
}