Revision 590fb3b7 monitor.c
b/monitor.c | ||
---|---|---|
2580 | 2580 |
|
2581 | 2581 |
static const mon_cmd_t *monitor_parse_command(Monitor *mon, |
2582 | 2582 |
const char *cmdline, |
2583 |
void *str_allocated[], |
|
2584 | 2583 |
QDict *qdict) |
2585 | 2584 |
{ |
2586 | 2585 |
const char *p, *typestr; |
... | ... | |
2657 | 2656 |
} |
2658 | 2657 |
str = qemu_malloc(strlen(buf) + 1); |
2659 | 2658 |
pstrcpy(str, sizeof(buf), buf); |
2660 |
str_allocated[nb_args] = str; |
|
2661 | 2659 |
add_str: |
2662 | 2660 |
if (nb_args >= MAX_ARGS) { |
2663 | 2661 |
error_args: |
... | ... | |
2667 | 2665 |
args[nb_args++] = str; |
2668 | 2666 |
if (str) |
2669 | 2667 |
qdict_put(qdict, key, qstring_from_str(str)); |
2668 |
qemu_free(str); |
|
2670 | 2669 |
} |
2671 | 2670 |
break; |
2672 | 2671 |
case '/': |
... | ... | |
2864 | 2863 |
|
2865 | 2864 |
static void monitor_handle_command(Monitor *mon, const char *cmdline) |
2866 | 2865 |
{ |
2867 |
int i; |
|
2868 | 2866 |
QDict *qdict; |
2869 | 2867 |
const mon_cmd_t *cmd; |
2870 |
void *str_allocated[MAX_ARGS]; |
|
2871 | 2868 |
|
2872 | 2869 |
qdict = qdict_new(); |
2873 | 2870 |
|
2874 |
for (i = 0; i < MAX_ARGS; i++) |
|
2875 |
str_allocated[i] = NULL; |
|
2876 |
|
|
2877 |
cmd = monitor_parse_command(mon, cmdline, str_allocated, qdict); |
|
2871 |
cmd = monitor_parse_command(mon, cmdline, qdict); |
|
2878 | 2872 |
if (cmd) { |
2879 | 2873 |
void (*handler)(Monitor *mon, const QDict *qdict); |
2880 | 2874 |
|
... | ... | |
2887 | 2881 |
} |
2888 | 2882 |
|
2889 | 2883 |
QDECREF(qdict); |
2890 |
|
|
2891 |
for (i = 0; i < MAX_ARGS; i++) |
|
2892 |
qemu_free(str_allocated[i]); |
|
2893 | 2884 |
} |
2894 | 2885 |
|
2895 | 2886 |
static void cmd_completion(const char *name, const char *list) |
Also available in: Unified diff