dotCipher/common-c-problems-and-xmalloc

Sets of common c problems demonstrated in indivitual tests, as well as an implementation of extended malloc (xmalloc) to solve most memory problems.

★ 0Forks 0CGitHub ↗Compare

README

Common C Bug Programs + xmalloc Library

Author: Cody Moore

Description

This directory consists of two different types of programs. All the programs with the names of prog-XX.c are different examples of some of the more common C bugs that are encountered.

Each program contains come basic output to demonstrate the C bug, and it also contains come basic comments if you wish to further know what the bug is and how to identify it.

This directory also includes a library for xmalloc to track the memory use and prevent common memory errors from occuring.

Included with the library is an example program that links the library so that you an better understand how to use it in your own code.

Installation

First thing you need to do to compile all programs is to run:

make

Or you can compile an individual test by:

make prog-XX OR make prog-XX-gcc

from within the same directory this README is in. At which point, you can then run each program test individually by:

make run-XX OR make run-XX-gcc

where XX is the number test to run.

You can compile the xmalloc library by running the command:

make xmalloc

This builds a file "xmalloc.o" which you can then link to any source you write and then write:

#include "xmalloc.h"

Finally you can compile the example code provided with the library by running

make xmalloc-test

Then run the program by entering:

./xmalloc-test

If you wish you can also clean your directory by running:

make clean

Notes

FOR SOLARIS: If you are running solaris please use gmake for all commands instead of make.

Issues