Changeset 2314


Ignore:
Timestamp:
Aug 18, 2009, 2:29:14 PM (10 years ago)
Author:
bruno
Message:

r3325@localhost: bruno | 2009-08-01 22:25:29 +0200
number_of_disks_as_string now alloctes memory

Location:
branches/2.2.10/mondo/src
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/2.2.10/mondo/src/common/libmondo-string.c

    r2313 r2314  
    421421
    422422    /*@ buffers ********************************************************* */
    423     static char output[MAX_STR_LEN];
     423    char *output = NULL;
    424424
    425425    /*@ char     ******************************************************** */
     
    433433        p = ' ';
    434434    }
    435     sprintf(output, "%d %s disk%c", noof_disks, label, p);
     435    mr_asprintf(&output, "%d %s disk%c", noof_disks, label, p);
    436436    while (strlen(output) < 14) {
    437         strcat(output, " ");
     437        mr_strcat(output, " ");
    438438    }
    439439    return (output);
  • branches/2.2.10/mondo/src/mondorestore/mondo-rstr-newt.c

    r2313 r2314  
    15611561    char *title_of_editraidForm_window;
    15621562    char *sz_raid_level;
    1563     char *sz_data_disks;
    1564     char *sz_spare_disks;
    1565     char *sz_parity_disks;
    1566     char *sz_failed_disks;
     1563    char *sz_data_disks = NULL;
     1564    char *sz_spare_disks = NULL;
     1565    char *sz_parity_disks = NULL;
     1566    char *sz_failed_disks = NULL;
    15671567
    15681568    /** newt **************************************************************/
     
    15841584    malloc_string(title_of_editraidForm_window);
    15851585    malloc_string(sz_raid_level);
    1586     malloc_string(sz_data_disks);
    1587     malloc_string(sz_spare_disks);
    1588     malloc_string(sz_parity_disks);
    1589     malloc_string(sz_failed_disks);
    15901586
    15911587    bkp_raidrec = mr_malloc(sizeof(struct raid_device_record));
     
    16021598        strcpy(sz_raid_level,
    16031599               turn_raid_level_number_to_string(raidrec->raid_level));
    1604         strcpy(sz_data_disks,
    1605                number_of_disks_as_string(raidrec->data_disks.entries,
    1606                                          "data"));
    1607         strcpy(sz_spare_disks,
    1608                number_of_disks_as_string(raidrec->spare_disks.entries,
    1609                                          "spare"));
    1610         strcpy(sz_parity_disks,
    1611                number_of_disks_as_string(raidrec->parity_disks.entries,
    1612                                          "parity"));
    1613         strcpy(sz_failed_disks,
    1614                number_of_disks_as_string(raidrec->failed_disks.entries,
    1615                                          "failed"));
     1600        /* Those 4 strings are allocated by the function  */
     1601        sz_data_disks = number_of_disks_as_string(raidrec->data_disks.entries, "data");
     1602        sz_spare_disks = number_of_disks_as_string(raidrec->spare_disks.entries, "spare");
     1603        sz_parity_disks = number_of_disks_as_string(raidrec->parity_disks.entries, "parity");
     1604        sz_failed_disks = number_of_disks_as_string(raidrec->failed_disks.entries, "failed");
    16161605        bSelectData = newtButton(1, 1, sz_data_disks);
    16171606        bSelectSpare = newtButton(20, 1, sz_spare_disks);
     
    16481637            break;
    16491638        }
     1639        mr_free(sz_data_disks);
     1640        mr_free(sz_spare_disks);
     1641        mr_free(sz_parity_disks);
     1642        mr_free(sz_failed_disks);
    16501643    }
    16511644    if (b_res == bCancel) {
     
    16571650    paranoid_free(title_of_editraidForm_window);
    16581651    paranoid_free(sz_raid_level);
    1659     paranoid_free(sz_data_disks);
    1660     paranoid_free(sz_spare_disks);
    1661     paranoid_free(sz_parity_disks);
    1662     paranoid_free(sz_failed_disks);
    16631652    paranoid_free(bkp_raidrec);
    16641653#endif
Note: See TracChangeset for help on using the changeset viewer.