corinthia-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Gabriela Gibson <gabriela.gib...@gmail.com>
Subject Re: Checking malloc success and adding perror()
Date Sun, 22 Feb 2015 12:13:52 GMT
Hi,

I propose to do the following:

1) Replace all the calls to *allocs (malloc, calloc, realloc)
{and also free()} with matching x* functions in DocFormats.

2) These new x*alloc functions will live in their respective
platform/src files, and will contain a call to the original
*alloc function and a simple exit handler.

3) I will create test cases in platform/tests/ for each of those
functions.  I can either put them in WrapperTests.c or create a
new, MallocTests.c file for them.

4) I will start out with free(), just to be certain I get the shape right
before I process the rest of the to-do list.

5) I will ship this as a 'git diff' files.

What do you think?

G

On Wed, Feb 18, 2015 at 9:19 PM, Gabriela Gibson <gabriela.gibson@gmail.com>
wrote:

> Hi,
>
> Reading through the source, I see that a lot of mallocs() do not have a
>
> [[
> if(foo == NULL) {
>     perror("Foo: Out of memory.\n");
>     return _exit(EXIT_FAILURE);
> }
> ]]
>
> check.
>
> I can add those if you like.
>
> G
> --
> Visit my Coding Diary: http://gabriela-gibson.blogspot.com/
>



-- 
Visit my Coding Diary: http://gabriela-gibson.blogspot.com/

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message