* Change indentation to 8 characters and coding style, for better reading the code.
* Add some memory allocation error handling.
* Fix memory leaks. In cases when Ctrl-C is used to exit the program,
'p' cannot be freed, so made it a global var, to share between main()
and sig_handler(). Signal handing is necessary to fix some leaks, so
added a very basic, non invasive, mechanism.
Signed-off-by: Davidlohr Bueso <dave@gnu.org> Signed-off-by: Karel Zak <kzak@redhat.com>