neovim/neovim — pull request #1260 by tarruda (2014-10-01 12:39:49+00:00)
Title: [WIP] Fix coverity defect(Resource leak) and add some specs which expose the bug to valgrind

This was introduced yesterday:

```
Defect(s) Reported-by: Coverity Scan
Showing 1 of 1 defect(s)

** CID 73646: Resource leak (RESOURCE_LEAK)
/src/nvim/eval.c: 14432 in get_system_output_as_rettv()

________________________________________________________________________________________________________
*** CID 73646: Resource leak (RESOURCE_LEAK)
/src/nvim/eval.c: 14432 in get_system_output_as_rettv()
14426 }
14427
14428 // get input to the shell command (if any), and its length
14429 ssize_t input_len;
14430 char *input = (char *) save_tv_as_string(&argvars[1], &input_len);
14431 if (input_len == -1) {
>>> CID 73646: Resource leak (RESOURCE_LEAK)
>>> Variable "input" going out of scope leaks the storage it points to.
14432 return;
14433 }
14434
14435 // get shell command to execute
14436 const char *cmd = (char *) get_tv_string(&argvars[0]);
14437
```

Since busted can now be used to run functional tests, there's no reason for not writing specs :)

This improves the functional helpers with an 'eval' function for inspecting vimL data structures and adds some specs for the `system()` function. Some of them make valgrind expose memory errors.