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 9297311
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T22:02:29+00:00 2026-06-18T22:02:29+00:00

I am using a c lib in my iPhone application. The c lib is

  • 0

I am using a c lib in my iPhone application. The c lib is written by someone I do not have access to.

However I am getting the error that object 0xa6000d is being freed but not allocated. The debug variable screenshot is here.

enter image description here

struct GtsMsg is defined as,

struct msg {
    int offset;
    int dataLength;
    u8* data;
    cBool expandable;
    cBool owned;
    u8* mid2key;
};

#define GtsMsg struct msg


void freeMessageData(GtsMsg* msg) {
    if (msg == NULL) return;
    if (msg->owned) {
        if (msg->data != NULL) {
            free(msg->data);
        }
    }
    free(msg->mid2key);
    memset(msg, 0, sizeof(GtsMsg));
}

The breakpoint for malloc_error_break is the line free(msg->data).

I have added the checking if (msg->data != NULL), but it did not work. What are the ways to check if the memory for msg->data or for msg is allocated or not?

Do you think there is something fishy, at *data = (u8)’\0′?

thanks in advance!

  • 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-18T22:02:38+00:00Added an answer on June 18, 2026 at 10:02 pm

    Thanks to all to your suggestions.
    Thanks hmjd for your tips.

    I found the struct is used in a cpp class which destructor calls the freeMessageData. But I could not find that the struct is initialized. So, if I initialize the struct to NULL in the declaration, this avoid the free memory problem and do not crash.

    Its something suggested by simonc. If he writes that as an answer not, comment, I could accept that.

    From comments of hmjd,

    The check for NULL is useless as free() will be a no-op if the pointer
    passed to it is NULL. Just because a pointer is not NULL does not mean
    it points a valid memory location (the memory may have already been
    freed or the pointer was never initialized to NULL). It is the
    responsibility of the programmer to ensure that the pointer is valid
    before attempting to free it.

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

Sidebar

Related Questions

Getting a VerifyError using the TweenMax lib when calling TweenMax.to . This error doesn't
I have some neural net code written in c# that would benefit from using
I have been using the lib-svm binaries for classification of my data. For training
I've encountered the Iconv::IllegalSequence error on some web pages when using mechanize lib. Is
I'm using regular expression lib icucore via RegKit on the iPhone to replace a
I need to create an application for the iPhone that will connect to a
I am using fftw3 lib for computing a fourier transform in c++. I have
I am using Titanium to develop an application to run on both iPhone and
I'm using mobclix lib in an iPhone app, I tried to replace the old
I'm using mobclix lib in an iPhone app, I tried to replace the old

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.