Ignore:
Timestamp:
Aug 28, 2009, 2:24:19 AM (15 years ago)
Author:
Bruno Cornec
Message:

Change inerface of evaluate_mountlist and spread_flaws_across_three_lines in order to solve bugs linked to strings management in these functions. May fix a restoration crash seen by some customers

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/2.2.9/mondo/src/mondorestore/mondo-rstr-newt.c

    r2230 r2350  
    19331933    /** int **************************************************************/
    19341934    int i = 0;
     1935    int res = 0;
    19351936    int currline = 0;
    19361937    int finished = FALSE;
     
    19381939    /** buffers **********************************************************/
    19391940    char tmp[MAX_STR_LEN];
     1941    char *flaws_str = NULL;
    19401942    char *flaws_str_A = NULL;
    19411943    char *flaws_str_B = NULL;
     
    19451947    assert(raidlist != NULL);
    19461948
    1947     mr_asprintf(&flaws_str_A, "%s", "         ");
    1948     mr_asprintf(&flaws_str_B, "%s", "         ");
    1949     mr_asprintf(&flaws_str_C, "%s", "         ");
    19501949    if (mountlist->entries > ARBITRARY_MAXIMUM) {
    19511950        log_to_screen("Arbitrary limits suck, man!");
     
    19641963            "Size (MB)");
    19651964    headerMsg = newtLabel(2, 1, tmp);
    1966     flawsLabelA = newtLabel(2, 13, flaws_str_A);
    1967     flawsLabelB = newtLabel(2, 14, flaws_str_B);
    1968     flawsLabelC = newtLabel(2, 15, flaws_str_C);
     1965    flawsLabelA = newtLabel(2, 13, "         ");
     1966    flawsLabelB = newtLabel(2, 14, "         ");
     1967    flawsLabelC = newtLabel(2, 15, "         ");
    19691968    partitionsListbox =
    19701969        newtListbox(2, 2, 10, NEWT_FLAG_SCROLL | NEWT_FLAG_RETURNEXIT);
     
    19761975                          bEdit, bDelete, bReload, bCancel, bOK, NULL);
    19771976    while (!finished) {
    1978         evaluate_mountlist(mountlist, flaws_str_A, flaws_str_B,
    1979                            flaws_str_C);
     1977        flaws_str = evaluate_mountlist(mountlist, &res);
     1978        spread_flaws_across_three_lines(flaws_str, flaws_str_A, flaws_str_B, flaws_str_C);
     1979
     1980        mr_free(flaws_str);
     1981
    19801982        newtLabelSetText(flawsLabelA, flaws_str_A);
    19811983        newtLabelSetText(flawsLabelB, flaws_str_B);
    19821984        newtLabelSetText(flawsLabelC, flaws_str_C);
    19831985        b_res = newtRunForm(myForm);
     1986        mr_free(flaws_str_A);
     1987        mr_free(flaws_str_B);
     1988        mr_free(flaws_str_C);
     1989
    19841990        if (b_res == bOK) {
    1985             if (!evaluate_mountlist
    1986                 (mountlist, flaws_str_A, flaws_str_B, flaws_str_C)) {
     1991            flaws_str = evaluate_mountlist(mountlist, &res);
     1992            mr_free(flaws_str);
     1993            if (!res) {
    19871994                finished =
    19881995                    ask_me_yes_or_no
     
    20382045        }
    20392046    }
    2040     paranoid_free(flaws_str_A);
    2041     paranoid_free(flaws_str_B);
    2042     paranoid_free(flaws_str_C);
    20432047    newtFormDestroy(myForm);
    20442048    newtPopWindow();
Note: See TracChangeset for help on using the changeset viewer.