Changeset 3611 in MondoRescue for branches/3.2/mondo/src/mondorestore


Ignore:
Timestamp:
Nov 10, 2016, 9:09:54 PM (9 years ago)
Author:
Bruno Cornec
Message:

Remove more static allocation

Location:
branches/3.2/mondo/src/mondorestore
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • branches/3.2/mondo/src/mondorestore/mondo-prep.c

    r3610 r3611  
    18391839    mr_asprintf(partcode, "");
    18401840} else if (strlen(format) >= 1 && strlen(format) <= 2) {
    1841     mr_asprintf(partcode, format);
     1841    mr_asprintf(partcode, "%s", format);
    18421842} else {
    18431843    /* probably an image */
     
    18471847
    18481848#ifdef __FreeBSD__
    1849     mr_asprintf(partcode, format);  // was a5
     1849    mr_asprintf(partcode, "%s", format);    // was a5
    18501850#else
    1851     mr_asprintf(partcode, format);  // was 83
     1851    mr_asprintf(partcode, "%s", format);    // was 83
    18521852#endif
    18531853}
  • branches/3.2/mondo/src/mondorestore/mondo-rstr-mountlist.c

    r3564 r3611  
    5555    /*@ buffers ******************************************************** */
    5656    char tmp = NULL;
     57    char tmp1 = NULL;
    5758    char device[MAX_STR_LEN];
    5859
     
    112113            }
    113114            if (device_copies > 1) {
    114                 mr_asprintf(tmp, " %s %s's.", number_to_text(device_copies), device);
     115                tmp1 = number_to_text(device_copies);
     116                mr_asprintf(tmp, " %s %s's.", tmp1, device);
     117                mr_free(tmp1);
    115118                if (!strstr(flaws_str, tmp)) {
    116119                    log_it(tmp);
     
    209212            }
    210213            if (device_copies > 1) {
    211                 mr_asprintf(tmp, " %s %s's.", number_to_text(device_copies), device);
     214                tmp1 = number_to_text(device_copies);
     215                mr_asprintf(tmp, " %s %s's.", tmp1, device);
     216                mr_free(tmp1);
    212217                if (!strstr(flaws_str, "%s", tmp)) {
    213218                    log_it(tmp);
     
    271276                }
    272277                if (device_copies > 1) {
    273                     mr_asprintf(tmp, " %s %s's.", number_to_text(device_copies), device);
     278                    tmp1 = number_to_text(device_copies);
     279                    mr_asprintf(tmp, " %s %s's.", tmp1, device);
     280                    mr_free(tmp1);
    274281                    if (!strstr(flaws_str, tmp)) {
    275282                        log_it(tmp);
     
    374381    /*@ buffers ******************************************************** */
    375382    char *tmp = NULL;
     383    char *tmp1 = NULL;
    376384    char *device = NULL;
    377385    char *flaws_str = NULL;
     
    452460        }
    453461        if (device_copies > 1) {
    454             mr_asprintf(tmp, " %s %s's.", number_to_text(device_copies), device);
     462            tmp1 = number_to_text(device_copies);
     463            mr_asprintf(tmp, " %s %s's.", tmp1, device);
     464            mr_free(tmp1);
    455465            if (!strstr(flaws_str, tmp)) {
    456466                log_it(tmp);
     
    536546    struct list_of_disks *drivelist;
    537547    char *tmp = NULL;
     548    char *tmp1 = NULL;
    538549    char *flaws_str = NULL;
    539550
     
    589600        }
    590601        if (copies > 1 && last_copy == currline && strcmp(curr_mountpoint, "raid")) {
    591             mr_asprintf(tmp, " %s %s's.", number_to_text(copies), curr_mountpoint);
     602            tmp1 = number_to_text(copies);
     603            mr_asprintf(tmp, " %s %s's.", tmp1, curr_mountpoint);
     604            mr_free(tmp1);
    592605            log_msg(8,"Adding: %s to flaws_str", tmp);
    593606            if (flaws_str != NULL) {
  • branches/3.2/mondo/src/mondorestore/mondo-rstr-newt.c

    r3289 r3611  
    12961296    }
    12971297    mr_free(size_str);
    1298     newtListboxSetEntry(listbox, (long) keylist[currline],
    1299                         mountlist_entry_to_string(mountlist, currline));
     1298
     1299    tmp = mountlist_entry_to_string(mountlist, currline);
     1300    newtListboxSetEntry(listbox, (long) keylist[currline], tmp);
     1301    mr_free(tmp);
     1302
    13001303    /* if new /dev/md RAID device then do funky stuff */
    13011304    if (strstr(mountlist->el[currline].device, RAID_DEVICE_STUB)
     
    15801583        mr_free(title_of_editraidForm_window);
    15811584        mr_asprintf(title_of_editraidForm_window, "Edit %s", raidrec->raid_device);
    1582         mr_asprintf(sz_raid_level, "%s", turn_raid_level_number_to_string(raidrec->raid_level));
     1585        sz_raid_level = turn_raid_level_number_to_string(raidrec->raid_level);
    15831586        sz_data_disks = number_of_disks_as_string(raidrec->data_disks.entries, "data");
    15841587        sz_spare_disks = number_of_disks_as_string(raidrec->spare_disks.entries, "spare");
     
    23352338    /** long **************************************************************/
    23362339    long i = 0;
     2340    char *tmp = NULL;
    23372341
    23382342    assert(disklist != NULL);
     
    23462350    }
    23472351    for (i = 0; i < disklist->entries; i++) {
    2348         newtListboxAppendEntry(listbox,
    2349                                disklist_entry_to_string(disklist, i),
    2350                                keylist[i]);
     2352        tmp = disklist_entry_to_string(disklist, i);
     2353        newtListboxAppendEntry(listbox, tmp, keylist[i]);
     2354        mr_free(tmp);
    23512355    }
    23522356}
     
    23672371    /** long **************************************************************/
    23682372    long i = 0;
     2373    char * tmp = NULL;
    23692374
    23702375    assert(mountlist != NULL);
     
    23782383    }
    23792384    for (i = 0; i < mountlist->entries; i++) {
    2380         newtListboxAppendEntry(listbox,
    2381                                mountlist_entry_to_string(mountlist, i),
    2382                                keylist[i]);
     2385        tmp = mountlist_entry_to_string(mountlist, i);
     2386        newtListboxAppendEntry(listbox, tmp, keylist[i]);
     2387        mr_free(tmp);
    23832388    }
    23842389}
Note: See TracChangeset for help on using the changeset viewer.