Properly cope with malloc fails; fixed major logic flaw in determine_targets

brainfuck.c and stack.c  should now do the proper thing if a call to malloc()
fails. All functions make sure they don't leave any memory leaking and
properly indicate failure to their callers.

I've also repaired a logic flaw in bf_determine_targets (which did indeed
report the program as invalid if it contained too many ']', but not if it had
too many '['). It should now properly identify invalid programs.

I've also added error checking and amde sure we actually do error checking
everytime something might have failed. I've yet to assign meaningful return
values to functions. At the moment, 0 indicates success and -1 indicates
failure, regardless of its type.

TODO: Implement proper error codes.