From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 26328 invoked by alias); 15 Oct 2003 12:54:24 -0000 Mailing-List: contact gcc-help-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-help-owner@gcc.gnu.org Received: (qmail 26321 invoked from network); 15 Oct 2003 12:54:24 -0000 Received: from unknown (HELO ssa8.serverconfig.com) (209.51.129.179) by sources.redhat.com with SMTP; 15 Oct 2003 12:54:24 -0000 Received: from 24-196-33-250.shb.wi.charter.com ([24.196.33.250] helo=192.168.1.2) by ssa8.serverconfig.com with asmtp (Exim 4.24) id 1A9lAU-0003P3-Uu for gcc-help@gcc.gnu.org; Wed, 15 Oct 2003 08:54:01 -0400 From: "Joseph D. Wagner" To: gcc-help@gcc.gnu.org Subject: Trouble with realloc Date: Wed, 15 Oct 2003 12:54:00 -0000 User-Agent: KMail/1.5.3 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200310150754.19930.theman@josephdwagner.info> X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - ssa8.serverconfig.com X-AntiAbuse: Original Domain - gcc.gnu.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - josephdwagner.info X-SW-Source: 2003-10/txt/msg00259.txt.bz2 I know this is a stupid, simple problem, and the answer is staring me right in the face, but I can't see it. I know you're going to laugh at me the moment you're done reading this email, but please help me just the same. I keep getting a segmentation fault on realloc. I've tried every combination of * and & that I can think of, but nothing helps. struct block_order_log_t { e2_blkcnt_t totalBlocks; blk_t *blockID; }; ... struct ext2_inode inode; struct block_order_log_t block_order_log; ... block_order_log.blockID = (blk_t*) calloc(inode.i_blocks, sizeof(struct block_order_log_t)); ... /* Allocates more memory for the log if needed */ if(inode.i_blocks > block_order_log.totalBlocks) { /* The problem is here */ block_order_log.blockID = (blk_t*) realloc(block_order_log.blockID, sizeof(struct block_order_log_t) * inode.i_blocks); } TIA. Joseph D. Wagner --------------------------------------------------------------------- "Introducing Microsoft Windows 2003 Server. Do more with less." -- MS Sales Motto "Do more with less"? Are you saying Windows 2003 is less?