From: "Joseph D. Wagner" <theman@josephdwagner.info>
To: linux-c-programming@vger.kernel.org
Subject: Pointer Woes: Pointer to a Pointer
Date: Tue, 18 Nov 2003 14:30:15 +0600 [thread overview]
Message-ID: <200311181430.15586.theman@josephdwagner.info> (raw)
valgrind (a.k.a. memcheck) says that the single line inside the 'for' loop
below is the cause of my problems, saying things like 'uninitialized
memory' and 'invalid write'. However, I can't figure out where I went
wrong in the line within my for loop. I'd appreciate an extra/fresh set of
eyes.
Is the problem in the single line inside the 'for' loop below, or is the
problem somewhere back in my realloc statements?
FYI:
e2_blkcnt_t is signed 64-bit int
ext2_int_t is unsigned 32-bit int
frag_log is a global variable
block_order_log is a local variable reused for each file examined
TIA.
Joseph D. Wagner
struct block_order_log_t
{
e2_blkcnt_t total_blocks;
size_t is_indirect_block_array_size;
bool *is_indirect_block;
size_t block_id_array_size;
blk_t *block_id;
};
struct fragments_log_t
{
u_int32_t total_fragmented_files;
size_t inode_id_array_size;
ext2_ino_t *inode_id;
size_t parent_inode_id_array_size;
ext2_ino_t *parent_inode_id;
size_t total_fragments_array_size;
e2_blkcnt_t *total_fragments;
size_t block_order_log_array_size;
struct block_order_log_t *block_order_log;
};
...
for(e2_blkcnt_t index = 1;
index <= block_order_log.total_blocks;
index++)
{
*((frag_log.block_order_log + frag_log.total_fragmented_files)->block_id
+ index) = *(block_order_log.block_id + index);
}
next reply other threads:[~2003-11-18 8:30 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-11-18 8:30 Joseph D. Wagner [this message]
2003-11-18 21:42 ` Pointer Woes: Pointer to a Pointer Glynn Clements
-- strict thread matches above, loose matches on Subject: below --
2003-11-18 23:07 Joseph D. Wagner
2003-11-19 15:29 Joseph D. Wagner
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=200311181430.15586.theman@josephdwagner.info \
--to=theman@josephdwagner.info \
--cc=linux-c-programming@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).