const struct menu *menu;
int key, rc;
const char *prompt;
- char buf[BUFSIZ];
+ char buf[BUFSIZ] = { '\0' };
if (fdisk_is_details(cxt))
prompt = _("Expert command (m for help): ");
switch (ent->key) {
case 'd':
rc = fdisk_ask_partnum(cxt, &n, FALSE);
- if (!rc)
- rc = fdisk_delete_partition(cxt, n);
+ if (rc)
+ break; /* no partitions yet (or ENOMEM, ...) */
+
+ rc = fdisk_delete_partition(cxt, n);
if (rc)
fdisk_warnx(cxt, _("Could not delete partition %zu"), n + 1);
else