mirror of
https://github.com/espressif/esp-idf.git
synced 2025-08-02 12:14:32 +02:00
Merge branch 'bugfix/console_cmd_register' into 'master'
console: initialize buf_size before calling open_memstream See merge request !1138
This commit is contained in:
@@ -105,11 +105,13 @@ esp_err_t esp_console_cmd_register(const esp_console_cmd_t *cmd)
|
|||||||
asprintf(&item->hint, " %s", cmd->hint);
|
asprintf(&item->hint, " %s", cmd->hint);
|
||||||
} else if (cmd->argtable) {
|
} else if (cmd->argtable) {
|
||||||
/* Generate hint based on cmd->argtable */
|
/* Generate hint based on cmd->argtable */
|
||||||
char* buf;
|
char* buf = NULL;
|
||||||
size_t buf_size;
|
size_t buf_size = 0;
|
||||||
FILE* f = open_memstream(&buf, &buf_size);
|
FILE* f = open_memstream(&buf, &buf_size);
|
||||||
|
if (f != NULL) {
|
||||||
arg_print_syntax(f, cmd->argtable, NULL);
|
arg_print_syntax(f, cmd->argtable, NULL);
|
||||||
fclose(f);
|
fclose(f);
|
||||||
|
}
|
||||||
item->hint = buf;
|
item->hint = buf;
|
||||||
}
|
}
|
||||||
item->argtable = cmd->argtable;
|
item->argtable = cmd->argtable;
|
||||||
|
Reference in New Issue
Block a user