Commit ea6e4fe2dd3594d04c03ddb0befc1c4a82ab4e83

Authored by ths
1 parent 17508796

Fix segfault when printing the help text, spotted by Stefan Weil.


git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@3030 c046a42c-6fe2-441c-8c8c-71466251a162
Showing 1 changed file with 4 additions and 4 deletions
@@ -6568,7 +6568,7 @@ int main_loop(void) @@ -6568,7 +6568,7 @@ int main_loop(void)
6568 return ret; 6568 return ret;
6569 } 6569 }
6570 6570
6571 -void help(void) 6571 +static void help(const char *optarg)
6572 { 6572 {
6573 printf("QEMU PC emulator version " QEMU_VERSION ", Copyright (c) 2003-2007 Fabrice Bellard\n" 6573 printf("QEMU PC emulator version " QEMU_VERSION ", Copyright (c) 2003-2007 Fabrice Bellard\n"
6574 "usage: %s [options] [disk_image]\n" 6574 "usage: %s [options] [disk_image]\n"
@@ -7450,12 +7450,12 @@ int main(int argc, char **argv) @@ -7450,12 +7450,12 @@ int main(int argc, char **argv)
7450 break; 7450 break;
7451 #endif 7451 #endif
7452 case QEMU_OPTION_h: 7452 case QEMU_OPTION_h:
7453 - help(); 7453 + help(optarg);
7454 break; 7454 break;
7455 case QEMU_OPTION_m: 7455 case QEMU_OPTION_m:
7456 ram_size = atoi(optarg) * 1024 * 1024; 7456 ram_size = atoi(optarg) * 1024 * 1024;
7457 if (ram_size <= 0) 7457 if (ram_size <= 0)
7458 - help(); 7458 + help(optarg);
7459 if (ram_size > PHYS_RAM_MAX_SIZE) { 7459 if (ram_size > PHYS_RAM_MAX_SIZE) {
7460 fprintf(stderr, "qemu: at most %d MB RAM can be simulated\n", 7460 fprintf(stderr, "qemu: at most %d MB RAM can be simulated\n",
7461 PHYS_RAM_MAX_SIZE / (1024 * 1024)); 7461 PHYS_RAM_MAX_SIZE / (1024 * 1024));
@@ -7741,7 +7741,7 @@ int main(int argc, char **argv) @@ -7741,7 +7741,7 @@ int main(int argc, char **argv)
7741 hd_filename[0] == '\0' && 7741 hd_filename[0] == '\0' &&
7742 (cdrom_index >= 0 && hd_filename[cdrom_index] == '\0') && 7742 (cdrom_index >= 0 && hd_filename[cdrom_index] == '\0') &&
7743 fd_filename[0] == '\0') 7743 fd_filename[0] == '\0')
7744 - help(); 7744 + help("");
7745 7745
7746 /* boot to floppy or the default cd if no hard disk defined yet */ 7746 /* boot to floppy or the default cd if no hard disk defined yet */
7747 if (hd_filename[0] == '\0' && boot_device == 'c') { 7747 if (hd_filename[0] == '\0' && boot_device == 'c') {