Changeset 21f1543 in mainline
- Timestamp:
- 2015-10-21T10:09:01Z (9 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- ef9dac04
- Parents:
- 852664b9
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/app/fdisk/fdisk.c
r852664b9 r21f1543 419 419 fdisk_part_info_t pinfo; 420 420 char *scap = NULL; 421 char *spkind = NULL; 421 422 char *sfstype = NULL; 422 423 char *sdesc = NULL; … … 452 453 } 453 454 454 rc = fdisk_fstype_format(pinfo.fstype, &sfstype); 455 if (rc != EOK) { 456 printf("Out of memory.\n"); 457 goto error; 458 } 459 460 rc = asprintf(&sdesc, "%s, %s", scap, sfstype); 461 if (rc < 0) { 462 rc = ENOMEM; 463 goto error; 455 rc = fdisk_pkind_format(pinfo.pkind, &spkind); 456 if (rc != EOK) { 457 printf("\nOut of memory.\n"); 458 goto error; 459 } 460 461 if (pinfo.pkind != lpk_extended) { 462 rc = fdisk_fstype_format(pinfo.fstype, &sfstype); 463 if (rc != EOK) { 464 printf("Out of memory.\n"); 465 goto error; 466 } 467 468 rc = asprintf(&sdesc, "%s, %s, %s", scap, spkind, sfstype); 469 if (rc < 0) { 470 rc = ENOMEM; 471 goto error; 472 } 473 474 } else { 475 rc = asprintf(&sdesc, "%s, %s", scap, spkind); 476 if (rc < 0) { 477 rc = ENOMEM; 478 goto error; 479 } 464 480 } 465 481 … … 473 489 free(scap); 474 490 scap = NULL; 491 free(spkind); 492 spkind = NULL; 475 493 free(sfstype); 476 494 sfstype = NULL; … … 481 499 } 482 500 501 rc = nchoice_add(choice, "Cancel", NULL, 0); 502 if (rc != EOK) { 503 assert(rc == ENOMEM); 504 printf("Out of memory.\n"); 505 goto error; 506 } 507 483 508 rc = nchoice_get(choice, &sel); 484 509 if (rc != EOK) { … … 487 512 } 488 513 489 rc = fdisk_part_destroy((fdisk_part_t *)sel); 490 if (rc != EOK) { 491 printf("Error deleting partition.\n"); 492 return rc; 514 if (sel != NULL) { 515 rc = fdisk_part_destroy((fdisk_part_t *)sel); 516 if (rc != EOK) { 517 printf("Error deleting partition.\n"); 518 return rc; 519 } 493 520 } 494 521 … … 497 524 error: 498 525 free(scap); 526 free(spkind); 499 527 free(sfstype); 500 528 free(sdesc);
Note:
See TracChangeset
for help on using the changeset viewer.