mirror of
https://github.com/neovim/neovim.git
synced 2025-02-25 18:55:25 -06:00
Merge pull request #1429 from oni-link/fix.job_start.leak
Fix memory leak in job_start().
This commit is contained in:
commit
8e281b3f70
@ -119,7 +119,7 @@ void channel_teardown(void)
|
|||||||
/// Creates an API channel by starting a job and connecting to its
|
/// Creates an API channel by starting a job and connecting to its
|
||||||
/// stdin/stdout. stderr is forwarded to the editor error stream.
|
/// stdin/stdout. stderr is forwarded to the editor error stream.
|
||||||
///
|
///
|
||||||
/// @param argv The argument vector for the process
|
/// @param argv The argument vector for the process. [consumed]
|
||||||
/// @return The channel id
|
/// @return The channel id
|
||||||
uint64_t channel_from_job(char **argv)
|
uint64_t channel_from_job(char **argv)
|
||||||
{
|
{
|
||||||
|
@ -106,6 +106,7 @@ void job_teardown(void)
|
|||||||
///
|
///
|
||||||
/// @param argv Argument vector for the process. The first item is the
|
/// @param argv Argument vector for the process. The first item is the
|
||||||
/// executable to run.
|
/// executable to run.
|
||||||
|
/// [consumed]
|
||||||
/// @param data Caller data that will be associated with the job
|
/// @param data Caller data that will be associated with the job
|
||||||
/// @param writable If true the job stdin will be available for writing with
|
/// @param writable If true the job stdin will be available for writing with
|
||||||
/// job_write, otherwise it will be redirected to /dev/null
|
/// job_write, otherwise it will be redirected to /dev/null
|
||||||
@ -139,6 +140,7 @@ Job *job_start(char **argv,
|
|||||||
|
|
||||||
if (i == MAX_RUNNING_JOBS) {
|
if (i == MAX_RUNNING_JOBS) {
|
||||||
// No free slots
|
// No free slots
|
||||||
|
shell_free_argv(argv);
|
||||||
*status = 0;
|
*status = 0;
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
@ -230,8 +230,12 @@ static void write_cb(uv_write_t *req, int status)
|
|||||||
|
|
||||||
if (data->wstream->freed && data->wstream->pending_reqs == 0) {
|
if (data->wstream->freed && data->wstream->pending_reqs == 0) {
|
||||||
// Last pending write, free the wstream;
|
// Last pending write, free the wstream;
|
||||||
|
if (data->wstream->free_handle) {
|
||||||
|
uv_close((uv_handle_t *)data->wstream->stream, close_cb);
|
||||||
|
} else {
|
||||||
free(data->wstream);
|
free(data->wstream);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
kmp_free(WRequestPool, wrequest_pool, data);
|
kmp_free(WRequestPool, wrequest_pool, data);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user