Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

helloworld.c memory leak or not? #3

Open
GoogleCodeExporter opened this issue Oct 4, 2015 · 0 comments
Open

helloworld.c memory leak or not? #3

GoogleCodeExporter opened this issue Oct 4, 2015 · 0 comments

Comments

@GoogleCodeExporter
Copy link

The comments inside helloworld.c shows there is an obviously memory leak.

/*
 * Allocates a new interpreter, and pushes a value into the global table.
 *
 * Returns a pointer to the iterator. Since no deallocation function has
 * been implemented, this will obviously leak memory.
 */

however, I'm  not sure on this, since the allocator used below can free memory 
blocks. Would you please clarify on this? 

static void *l_alloc (void *ud, void *ptr, size_t osize, size_t nsize) {
  (void)ud;
  (void)osize;
  if (nsize == 0) {
    free(ptr);
    return NULL;
  }
  else
    return realloc(ptr, nsize);
}

Original issue reported on code.google.com by [email protected] on 18 Aug 2012 at 2:45

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant