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

  • SEARCH
  • Home
  • 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 8278439
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T09:00:45+00:00 2026-06-08T09:00:45+00:00

I seem to have a memory corruption in my C program. I used _ASSERTE(

  • 0

I seem to have a memory corruption in my C program. I used _ASSERTE( _CrtCheckMemory( ) ); to find the problem statement and it breaks on a line that says scep_conf->engine_str = NULL; right before it. So if I understood it correctly, the malloc before that broke something, right?

So this is the part of the code that causes the issue:

scep_conf = (SCEP_CONF *) malloc(sizeof(scep_conf));
scep_conf->engine = (struct scep_engine_conf_st *) malloc(sizeof(struct scep_engine_conf_st));
scep_conf->engine_str = NULL;

The definitions from the header:

typedef struct {
    struct scep_engine_conf_st *engine;
    char *engine_str;
} SCEP_CONF;

struct scep_engine_conf_st{
    char *engine_id;
    char *new_key_location;
    int storelocation; 
    char *dynamic_path;
    char *module_path; 
    int engine_usage;
};

SCEP_CONF *scep_conf;

Basically I don’t get why it would corrupt my memory here. I am new to C and so there may be something obvious I am not seeing.

Any help will be greatly appreciated, thank you.

  • 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-08T09:00:47+00:00Added an answer on June 8, 2026 at 9:00 am

    This is incorrect:

    scep_conf = (SCEP_CONF *) malloc(sizeof(scep_conf)); 
    

    as it only allocates enough memory for a SCEP_CONF*, not a SCEP_CONF. it should be:

    scep_conf = malloc(sizeof(*scep_conf)); /* cast unnecessary. */
    

    Worth reading Do I cast the result of malloc?

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

Sidebar

Related Questions

I have a memory management problem that i can't seem to find a solution
Seem to have a memory allocation problem and think it's because in my struct,
I seem to have a problem passing some strings on from one form to
I seem to have found a bug in jQuery UI that duplicates dragged elements
I seem to have a problem with getting MVC to fill in my custom
I seem to have the exact opposite problem than this question on stopping dock
I seem to have an issue with somebody injecting code into the memory of
I seem to have a memory leak and I'm not sure how to fix.
I have memory mapped a large formatted (text) file containing one integer per line
I have a GUI application that doesn't have a memory leak. I have confirmed

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.