Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8927679
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T08:16:19+00:00 2026-06-15T08:16:19+00:00

Hi I have problem with this: tmpy = (int**)realloc(os,y*sizeof(int*)); os = tmpy; tmpy=NULL; for(i=0;i<y;i++)

  • 0

Hi I have problem with this:

tmpy = (int**)realloc(os,y*sizeof(int*));
os = tmpy;
tmpy=NULL;
for(i=0;i<y;i++) {
    tmpx = (int*)realloc(os[i],x*sizeof(int)); 
    os[i] = tmpx;
    tmpx=NULL;
}

Program runs good but valgrind gives this error:

==12513== Conditional jump or move depends on uninitialised value(s)
==12513==    at 0x402BF0D: realloc (in /usr/lib/valgrind/vgpreload_memcheck-x86-linux.so)
==12513==    by 0x8048760: main (main.c:55)
==12513==  Uninitialised value was created by a heap allocation
==12513==    at 0x402BF52: realloc (in /usr/lib/valgrind/vgpreload_memcheck-x86-linux.so)
==12513==    by 0x804871E: main (main.c:50)
==12513== 

What is wrong? Thank you for your help.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T08:16:20+00:00Added an answer on June 15, 2026 at 8:16 am

    Assuming os is being realloc()d to a larger size, then the additional int* effectively added to os will be uninitialised pointers (accessed by os[i]). These unitialised pointers are eventually passed to realloc() within the for loop:

    tmpx = (int*)realloc(os[i],x*sizeof(int));
    

    The pointer passed to realloc() must be NULL or a value previously returned by malloc(), realloc() or calloc(). Set the additional int* to NULL before entering the for loop. Note the cast on return value of realloc() is unrequired.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm using a font in my site: http://www.fontsquirrel.com/fonts/Bentham But I have a problem: This
I have problem with this query DECLARE @INPUT INT SET @INPUT = 12345 ;
Hey most of my issue has been solved but i have little problem This
Possible Duplicate: Floating point error in representation? I have problem with this code int
I'm have problem with Isometric. I'm don't know how to name this problem, but
I have problem with this query, complexity of this query is not good, i
I using multilanguage solution from this thread Multilanguage in WPF But i have problem
I readed the userguide also this question , but still have problem with the
I try to do a migration but i have problem with this query :
I have problem with this code: file = tempfile.TemporaryFile(mode='wrb') file.write(base64.b64decode(data)) file.flush() os.fsync(file) # file.seek(0)

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.