Changeset 1080 in MondoRescue for branches/stable/mondo/src


Ignore:
Timestamp:
Jan 28, 2007, 7:04:41 PM (17 years ago)
Author:
Bruno Cornec
Message:
  • Fix mindi install messages (reported by Andree Leidenfrost)
  • remove paranoid_free/free for mr_free
  • mr_asprintf used everywhere
  • mr_malloc used everywhere
Location:
branches/stable/mondo/src
Files:
21 edited

Legend:

Unmodified
Added
Removed
  • branches/stable/mondo/src/common/libmondo-archive.c

    r1075 r1080  
    267267    }
    268268
    269     paranoid_free(command);
    270     paranoid_free(zipparams);
    271     paranoid_free(tmp);
     269    mr_free(command);
     270    mr_free(zipparams);
     271    mr_free(tmp);
    272272    return (retval);
    273273}
     
    403403        }
    404404    }
    405     paranoid_free(command);
    406     paranoid_free(zipparams);
    407     paranoid_free(tmp);
     405    mr_free(command);
     406    mr_free(zipparams);
     407    mr_free(tmp);
    408408    return (retval);
    409409}
     
    496496        sleep(2);
    497497    }
    498     paranoid_free(tmp);
     498    mr_free(tmp);
    499499    return (retval);
    500500}
     
    565565
    566566    assert(bkpinfo != NULL);
    567     command = malloc(1200);
     567    command = mr_malloc(1200);
    568568    malloc_string(tmp);
    569569    malloc_string(scratchdir);
     
    814814
    815815    if (g_getfattr) {
    816         asprintf(&tmp1, "%s/XATTR", bkpinfo->tmpdir);
     816        mr_asprintf(&tmp1, "%s/XATTR", bkpinfo->tmpdir);
    817817        if (write_one_liner_data_file(tmp1, "TRUE")) {
    818818            log_msg(1, "%ld: Unable to write one-liner XATTR",
    819819                __LINE__);
    820820        }
    821         paranoid_free(tmp1);
     821        mr_free(tmp1);
    822822    }
    823823    if (g_getfacl) {
    824         asprintf(&tmp1, "%s/ACL", bkpinfo->tmpdir);
     824        mr_asprintf(&tmp1, "%s/ACL", bkpinfo->tmpdir);
    825825        if (write_one_liner_data_file(tmp1, "TRUE")) {
    826826            log_msg(1, "%ld: Unable to write one-liner ACL",
    827827                __LINE__);
    828828        }
    829         paranoid_free(tmp1);
     829        mr_free(tmp1);
    830830    }
    831831
     
    849849
    850850    if (bkpinfo->backup_media_type == usb) {
    851         asprintf(&tmp2, "--usb %s", bkpinfo->media_device);
     851        mr_asprintf(&tmp2, "--usb %s", bkpinfo->media_device);
    852852    } else {
    853         asprintf(&tmp2,"");
     853        mr_asprintf(&tmp2,"");
    854854    }
    855855
     
    935935        }
    936936    }
    937     paranoid_free(tmp);
    938     paranoid_free(use_lzo_sz);
    939     paranoid_free(use_gzip_sz);
    940     paranoid_free(scratchdir);
    941     paranoid_free(use_comp_sz);
    942     paranoid_free(bootldr_str);
    943     paranoid_free(tape_device);
    944     paranoid_free(last_filelist_number);
    945     paranoid_free(broken_bios_sz);
    946     paranoid_free(cd_recovery_sz);
    947     paranoid_free(tape_size_sz);
    948     paranoid_free(devs_to_exclude);
    949     paranoid_free(use_lilo_sz);
    950     paranoid_free(value);
    951     paranoid_free(bootdev);
    952     paranoid_free(command);
    953     paranoid_free(use_star_sz);
     937    mr_free(tmp);
     938    mr_free(use_lzo_sz);
     939    mr_free(use_gzip_sz);
     940    mr_free(scratchdir);
     941    mr_free(use_comp_sz);
     942    mr_free(bootldr_str);
     943    mr_free(tape_device);
     944    mr_free(last_filelist_number);
     945    mr_free(broken_bios_sz);
     946    mr_free(cd_recovery_sz);
     947    mr_free(tape_size_sz);
     948    mr_free(devs_to_exclude);
     949    mr_free(use_lilo_sz);
     950    mr_free(value);
     951    mr_free(bootdev);
     952    mr_free(command);
     953    mr_free(use_star_sz);
    954954    return (res);
    955955}
     
    11221122    log_msg(3, "%s[%d:%d] - exiting", FORTY_SPACES, getpid(),
    11231123            this_thread_no);
    1124     paranoid_free(archiving_filelist_fname);
    1125     paranoid_free(archiving_afioball_fname);
    1126     paranoid_free(curr_xattr_list_fname);
    1127     paranoid_free(curr_acl_list_fname);
    1128     paranoid_free(tmp);
     1124    mr_free(archiving_filelist_fname);
     1125    mr_free(archiving_afioball_fname);
     1126    mr_free(curr_xattr_list_fname);
     1127    mr_free(curr_acl_list_fname);
     1128    mr_free(tmp);
    11291129    pthread_exit(NULL);
    11301130}
     
    12591259                                     BLK_START_OF_BACKUP);
    12601260    }
    1261     paranoid_free(command);
    1262     paranoid_free(tmpfile);
    1263     paranoid_free(data_disks_file);
     1261    mr_free(command);
     1262    mr_free(tmpfile);
     1263    mr_free(data_disks_file);
    12641264    return (retval);
    12651265}
     
    13501350    }
    13511351    unlink(tempfile);
    1352     paranoid_free(command);
    1353     paranoid_free(tempfile);
     1352    mr_free(command);
     1353    mr_free(tempfile);
    13541354    return (res);
    13551355}
     
    13791379    assert_string_is_neither_NULL_nor_zerolength(device);
    13801380    malloc_string(title);
    1381     command = malloc(1000);
     1381    command = mr_malloc(1000);
    13821382    if (!system("which superformat > /dev/null 2> /dev/null")) {
    13831383        sprintf(command, "superformat %s", device);
     
    13951395        }
    13961396    }
    1397     paranoid_free(title);
    1398     paranoid_free(command);
     1397    mr_free(title);
     1398    mr_free(command);
    13991399    return (res);
    14001400}
     
    14851485    log_msg(8, "here");
    14861486    assert(bkpinfo != NULL);
    1487     tmp = malloc(MAX_STR_LEN * 2);
     1487    tmp = mr_malloc(MAX_STR_LEN * 2);
    14881488    malloc_string(result_str);
    14891489    malloc_string(curr_xattr_list_fname);
     
    14931493    malloc_string(storing_afioball_fname);
    14941494    transfer_block =
    1495         malloc(sizeof(struct s_bkpinfo) + BKPINFO_LOC_OFFSET + 64);
     1495        mr_malloc(sizeof(struct s_bkpinfo) + BKPINFO_LOC_OFFSET + 64);
    14961496    memset((void *) transfer_block, 0,
    14971497           sizeof(struct s_bkpinfo) + BKPINFO_LOC_OFFSET + 64);
     
    16541654    }
    16551655    log_to_screen(tmp);
    1656     paranoid_free(transfer_block);
    1657     paranoid_free(result_str);
    1658     paranoid_free(storing_filelist_fname);
    1659     paranoid_free(media_usage_comment);
    1660     paranoid_free(storing_afioball_fname);
    1661     paranoid_free(curr_xattr_list_fname);
    1662     paranoid_free(curr_acl_list_fname);
     1656    mr_free(transfer_block);
     1657    mr_free(result_str);
     1658    mr_free(storing_filelist_fname);
     1659    mr_free(media_usage_comment);
     1660    mr_free(storing_afioball_fname);
     1661    mr_free(curr_xattr_list_fname);
     1662    mr_free(curr_acl_list_fname);
    16631663    return (retval);
    16641664}
     
    17181718    malloc_string(sz_blank_disk);
    17191719    malloc_string(fnam);
    1720     tmp = malloc(1200);
    1721     tmp2 = malloc(1200);
    1722     tmp3 = malloc(1200);
     1720    tmp = mr_malloc(1200);
     1721    tmp2 = mr_malloc(1200);
     1722    tmp3 = mr_malloc(1200);
    17231723    assert(bkpinfo != NULL);
    17241724    assert_string_is_neither_NULL_nor_zerolength(destfile);
     
    17541754       }
    17551755     */
    1756     free(tmp2);
    1757     free(tmp3);
    1758     tmp2 = NULL;
    1759     tmp3 = NULL;
     1756    mr_free(tmp2);
     1757    mr_free(tmp3);
    17601758    if (bkpinfo->backup_media_type == iso && bkpinfo->manual_cd_tray) {
    17611759        popup_and_OK("Please insert new media and press Enter.");
     
    20072005        log_msg(1, "WARNING - make_iso_fs returned an error");
    20082006    }
    2009     paranoid_free(old_pwd);
    2010     paranoid_free(result_sz);
    2011     paranoid_free(message_to_screen);
    2012     paranoid_free(sz_blank_disk);
    2013     paranoid_free(fnam);
    2014     paranoid_free(tmp);
     2007    mr_free(old_pwd);
     2008    mr_free(result_sz);
     2009    mr_free(message_to_screen);
     2010    mr_free(sz_blank_disk);
     2011    mr_free(fnam);
     2012    mr_free(tmp);
    20152013    return (retval);
    20162014}
     
    22202218    close_progress_form();
    22212219    paranoid_fclose(fin);
    2222     paranoid_free(tmp);
    2223     paranoid_free(bigfile_fname);
    2224     paranoid_free(sz_devfile);
     2220    mr_free(tmp);
     2221    mr_free(bigfile_fname);
     2222    mr_free(sz_devfile);
    22252223    return (retval);
    22262224}
     
    22552253    malloc_string(curr_acl_list_fname);
    22562254
    2257     tmp = malloc(MAX_STR_LEN * 2);
     2255    tmp = mr_malloc(MAX_STR_LEN * 2);
    22582256
    22592257    sprintf(tmp, "%s/archives/filelist.full", bkpinfo->scratchdir);
     
    23602358    }
    23612359    log_to_screen(tmp);
    2362     paranoid_free(tmp);
    2363     paranoid_free(curr_filelist_fname);
    2364     paranoid_free(curr_afioball_fname);
    2365     paranoid_free(media_usage_comment);
    2366     paranoid_free(curr_xattr_list_fname);
    2367     paranoid_free(curr_acl_list_fname);
     2360    mr_free(tmp);
     2361    mr_free(curr_filelist_fname);
     2362    mr_free(curr_afioball_fname);
     2363    mr_free(media_usage_comment);
     2364    mr_free(curr_xattr_list_fname);
     2365    mr_free(curr_acl_list_fname);
    23682366    return (retval);
    23692367}
     
    24462444    malloc_string(xattr_fname);
    24472445    malloc_string(acl_fname);
    2448     command = malloc(1200);
     2446    command = mr_malloc(1200);
    24492447    mvaddstr_and_log_it(g_currentY, 0,
    24502448                        "Archiving large files to media           ");
     
    24962494        mvaddstr_and_log_it(g_currentY++, 74, "Done.");
    24972495    }
    2498     paranoid_free(blah);
    2499     paranoid_free(biggielist);
    2500     paranoid_free(command);
    2501     paranoid_free(xattr_fname);
    2502     paranoid_free(acl_fname);
     2496    mr_free(blah);
     2497    mr_free(biggielist);
     2498    mr_free(command);
     2499    mr_free(xattr_fname);
     2500    mr_free(acl_fname);
    25032501    return (retval);
    25042502}
     
    25522550    assert(bkpinfo != NULL);
    25532551    malloc_string(curr_file);
    2554     tmp = malloc(1200);
     2552    tmp = mr_malloc(1200);
    25552553    would_occupy = space_occupied_by_cd(bkpinfo->scratchdir);
    25562554    va_start(ap, files_to_add); // initialize the variable arguments
     
    26062604                "Warning - errors occurred while I was adding files to CD dir");
    26072605    }
    2608     paranoid_free(tmp);
    2609     paranoid_free(curr_file);
     2606    mr_free(tmp);
     2607    mr_free(curr_file);
    26102608    return (retval);
    26112609}
     
    27682766        }
    27692767    }
    2770     paranoid_free(tmp);
    2771     paranoid_free(comment);
    2772     paranoid_free(bootdisk_dev);
    2773     paranoid_free(datadisk_dev);
     2768    mr_free(tmp);
     2769    mr_free(comment);
     2770    mr_free(bootdisk_dev);
     2771    mr_free(datadisk_dev);
    27742772    return (res);
    27752773}
     
    29132911                "Warning - errors occurred while I was adding file to tape");
    29142912    }
    2915     paranoid_free(curr_file);
     2913    mr_free(curr_file);
    29162914    return (retval);
    29172915}
     
    29732971    }
    29742972//  retract_CD_tray_and_defeat_autorun();
    2975     paranoid_free(tmp);
    2976     paranoid_free(cdrecord);
    2977     paranoid_free(bkp);
     2973    mr_free(tmp);
     2974    mr_free(cdrecord);
     2975    mr_free(bkp);
    29782976    return (res);
    29792977}
     
    31363134    log_to_screen("Proceeding w/ %s in drive.",
    31373135                  media_descriptor_string(g_backup_media_type));
    3138     paranoid_free(tmp);
    3139     paranoid_free(szmsg);
    3140     paranoid_free(cdrom_dev);
    3141     paranoid_free(cdrw_dev);
    3142     paranoid_free(mtpt);
    3143     paranoid_free(szcdno);
    3144     paranoid_free(szserfname);
    3145     paranoid_free(our_serial_str);
    3146     paranoid_free(szunmount);
     3136    mr_free(tmp);
     3137    mr_free(szmsg);
     3138    mr_free(cdrom_dev);
     3139    mr_free(cdrw_dev);
     3140    mr_free(mtpt);
     3141    mr_free(szcdno);
     3142    mr_free(szserfname);
     3143    mr_free(our_serial_str);
     3144    mr_free(szunmount);
    31473145    if (pmountable) {
    31483146        if (attempt_to_mount_returned_this) {
     
    32653263    malloc_string(file_to_archive);
    32663264    malloc_string(suffix);
    3267     command = malloc(MAX_STR_LEN * 8);
     3265    command = mr_malloc(MAX_STR_LEN * 8);
    32683266
    32693267    biggiestruct.for_backward_compatibility = '\n';
    32703268    biggiestruct.use_ntfsprog = use_ntfsprog;
    3271     if (!(tempblock = (char *) malloc(256 * 1024))) {
    3272         fatal_error("malloc error 256*1024");
    3273     }
     3269    tempblock = (char *) mr_malloc(256 * 1024);
    32743270    optimal_set_size = bkpinfo->optimal_set_size;
    32753271    if (is_this_file_compressed(biggie_filename)
     
    33383334                biggie_filename);
    33393335        log_to_screen(tmp);
    3340         paranoid_free(tempblock);
    3341         paranoid_free(tmp);
    3342         paranoid_free(checksum_line);
    3343         paranoid_free(command);
     3336        mr_free(tempblock);
     3337        mr_free(tmp);
     3338        mr_free(checksum_line);
     3339        mr_free(command);
    33443340        return (1);
    33453341    }
     
    34733469    }
    34743470    log_msg(1, tmp);
    3475     paranoid_free(tempblock);
    3476     paranoid_free(tmp);
    3477     paranoid_free(checksum_line);
    3478     paranoid_free(command);
    3479     paranoid_free(curr_slice_fname_uncompressed);
    3480     paranoid_free(curr_slice_fname_compressed);
    3481     paranoid_free(file_to_archive);
    3482     paranoid_free(suffix);
     3471    mr_free(tempblock);
     3472    mr_free(tmp);
     3473    mr_free(checksum_line);
     3474    mr_free(command);
     3475    mr_free(curr_slice_fname_uncompressed);
     3476    mr_free(curr_slice_fname_compressed);
     3477    mr_free(file_to_archive);
     3478    mr_free(suffix);
    34833479    return (retval);
    34843480}
     
    35253521    sprintf(tmp, "ls -l %s", dir);
    35263522    run_program_and_log_output(tmp, FALSE);
    3527     paranoid_free(tmp);
    3528     paranoid_free(dir);
     3523    mr_free(tmp);
     3524    mr_free(dir);
    35293525}
    35303526
     
    35733569#endif
    35743570    log_msg(2, "Returning from writing final ISO (res=%d)", res);
    3575     paranoid_free(tmp);
     3571    mr_free(tmp);
    35763572    return (res);
    35773573}
     
    37403736
    37413737    bkpinfo->verify_data = orig_vfy_flag_val;
    3742     paranoid_free(tmp);
    3743     paranoid_free(cdno_fname);
    3744     paranoid_free(lastcd_fname);
    3745     paranoid_free(isofile);
     3738    mr_free(tmp);
     3739    mr_free(cdno_fname);
     3740    mr_free(lastcd_fname);
     3741    mr_free(isofile);
    37463742    return (0);
    37473743}
     
    38433839        }
    38443840    }
    3845     paranoid_free(tmp);
     3841    mr_free(tmp);
    38463842    return (retval);
    38473843}
     
    39313927    paranoid_fclose(fin);
    39323928    paranoid_fclose(fout);
    3933     paranoid_free(tmp);
    3934     paranoid_free(title);
     3929    mr_free(tmp);
     3930    mr_free(title);
    39353931    close_evalcall_form();
    39363932    return (res);
  • branches/stable/mondo/src/common/libmondo-devices.c

    r1075 r1080  
    139139        is_this_a_ramdisk = TRUE;
    140140    }
    141     paranoid_free(tmp);
    142     paranoid_free(comment);
     141    mr_free(tmp);
     142    mr_free(comment);
    143143    log_msg(1, "Is this a ramdisk? result = %d", is_this_a_ramdisk);
    144144    return (is_this_a_ramdisk);
     
    228228    log_msg(3, "Ejecting %s", dev);
    229229    res2 = run_program_and_log_output(command, 1);
    230     paranoid_free(command);
     230    mr_free(command);
    231231    if (res1 && res2) {
    232232        return (1);
     
    260260#endif
    261261    i = run_program_and_log_output(command, FALSE);
    262     paranoid_free(command);
     262    mr_free(command);
    263263    return (i);
    264264}
     
    287287        ret = TRUE;
    288288    }
    289     paranoid_free(tmp);
     289    mr_free(tmp);
    290290    return (ret);
    291291}
     
    365365        log_OS_error("Cannot pclose fin");
    366366    }
    367     paranoid_free(program);
    368     paranoid_free(incoming);
    369     paranoid_free(searchstr);
    370     paranoid_free(tmp);
     367    mr_free(program);
     368    mr_free(incoming);
     369    mr_free(searchstr);
     370    mr_free(tmp);
    371371    return (res);
    372372}
     
    398398            dev, str);
    399399    i = system(command);
    400     paranoid_free(command);
     400    mr_free(command);
    401401    if (i) {
    402402        return (FALSE);
     
    425425            dev, n, str);
    426426    i = system(command);
    427     paranoid_free(command);
     427    mr_free(command);
    428428    if (i) {
    429429        return (FALSE);
     
    487487        log_msg(1, "mount succeeded with %s", dev);
    488488    }
    489     paranoid_free(dev);
     489    mr_free(dev);
    490490    return (res);
    491491}
     
    522522        strcpy(cdrw_device, g_cdrw_drive_is_here);
    523523        log_msg(3, "Been there, done that. Returning %s", cdrw_device);
    524         paranoid_free(comment);
    525         paranoid_free(tmp);
    526         paranoid_free(cdr_exe);
    527         paranoid_free(command);
     524        mr_free(comment);
     525        mr_free(tmp);
     526        mr_free(cdr_exe);
     527        mr_free(command);
    528528        return (0);
    529529    }
     
    531531        log_msg(1,
    532532                "This is dumb. You're calling find_cdrw_device() but you're backing up to DVD. WTF?");
    533         paranoid_free(comment);
    534         paranoid_free(tmp);
    535         paranoid_free(cdr_exe);
    536         paranoid_free(command);
     533        mr_free(comment);
     534        mr_free(tmp);
     535        mr_free(cdr_exe);
     536        mr_free(command);
    537537        return (1);
    538538    }
     
    551551    }
    552552    if (strlen(tmp) < 2) {
    553         paranoid_free(comment);
    554         paranoid_free(tmp);
    555         paranoid_free(cdr_exe);
    556         paranoid_free(command);
     553        mr_free(comment);
     554        mr_free(tmp);
     555        mr_free(cdr_exe);
     556        mr_free(command);
    557557        return 1;
    558558    } else {
     
    561561        log_it(comment);
    562562        strcpy(g_cdrw_drive_is_here, cdrw_device);
    563         paranoid_free(comment);
    564         paranoid_free(tmp);
    565         paranoid_free(cdr_exe);
    566         paranoid_free(command);
     563        mr_free(comment);
     564        mr_free(tmp);
     565        mr_free(cdr_exe);
     566        mr_free(command);
    567567        return (0);
    568568    }
     
    872872    }
    873873  end_of_find_cdrom_device:
    874     paranoid_free(tmp);
    875     paranoid_free(cdr_exe);
    876     paranoid_free(phrase_one);
    877     paranoid_free(phrase_two);
    878     paranoid_free(command);
    879     paranoid_free(dvd_last_resort);
    880     paranoid_free(mountpoint);
     874    mr_free(tmp);
     875    mr_free(cdr_exe);
     876    mr_free(phrase_one);
     877    mr_free(phrase_two);
     878    mr_free(command);
     879    mr_free(dvd_last_resort);
     880    mr_free(mountpoint);
    881881    return (retval);
    882882}
     
    11201120                outL = tempLa * tempLb / 1024 * tempLc / 1024;
    11211121                if (outL > 100) {
    1122                     paranoid_free(tmp);
    1123                     paranoid_free(command);
     1122                    mr_free(tmp);
     1123                    mr_free(command);
    11241124                    return (outL);
    11251125                }
     
    11341134    strcpy(tmp, call_program_and_get_last_line_of_output(command));
    11351135    if (atol(tmp) > 0) {
    1136         paranoid_free(tmp);
    1137         paranoid_free(command);
     1136        mr_free(tmp);
     1137        mr_free(command);
    11381138        return (atol(tmp));
    11391139    }
     
    11441144        strcpy(tmp, p + 1);
    11451145    } else {
    1146         paranoid_free(tmp);
    1147         paranoid_free(command);
     1146        mr_free(tmp);
     1147        mr_free(command);
    11481148        return (-1);
    11491149    }
     
    11631163        log_msg(3, "Cannot find %s's size: dmesg isn't helping either.",
    11641164                drive);
    1165         paranoid_free(tmp);
    1166         paranoid_free(command);
     1165        mr_free(tmp);
     1166        mr_free(command);
    11671167        return (-1);
    11681168    }
     
    11721172    outL = atol(p);
    11731173    if (outL <= 0) {
    1174         paranoid_free(tmp);
    1175         paranoid_free(command);
     1174        mr_free(tmp);
     1175        mr_free(command);
    11761176        return (-1);
    11771177    }
     
    11791179        outL = outL * 1024;
    11801180    }
    1181     paranoid_free(tmp);
    1182     paranoid_free(command);
     1181    mr_free(tmp);
     1182    mr_free(command);
    11831183    return (outL * 19 / 20);
    11841184#endif
     
    12381238        }
    12391239    }
    1240     paranoid_free(good_formats);
    1241     paranoid_free(command);
    1242     paranoid_free(format_sz);
     1240    mr_free(good_formats);
     1241    mr_free(command);
     1242    mr_free(format_sz);
    12431243    return (retval);
    12441244}
     
    13181318    }
    13191319  end_of_func:
    1320     paranoid_free(incoming);
    1321     paranoid_free(device_with_tab);
    1322     paranoid_free(device_with_space);
    1323     paranoid_free(tmp);
     1320    mr_free(incoming);
     1321    mr_free(device_with_tab);
     1322    mr_free(device_with_space);
     1323    mr_free(tmp);
    13241324    return (retval);
    13251325}
     
    14541454    log_msg(1, "system(%s) returned %d", command, retval);
    14551455
    1456     paranoid_free(command);
    1457     paranoid_free(dev);
    1458     paranoid_free(options);
     1456    mr_free(command);
     1457    mr_free(dev);
     1458    mr_free(options);
    14591459    return (retval);
    14601460}
     
    15711571        g_current_media_number = cd_number_i_want;
    15721572    }
    1573     paranoid_free(tmp);
    1574     paranoid_free(request);
     1573    mr_free(tmp);
     1574    mr_free(request);
    15751575}
    15761576
     
    21732173        }
    21742174    }
    2175     paranoid_free(tmp);
    2176     paranoid_free(sz_size);
    2177     paranoid_free(command);
    2178     paranoid_free(comment);
    2179     paranoid_free(prompt);
     2175    mr_free(tmp);
     2176    mr_free(sz_size);
     2177    mr_free(command);
     2178    mr_free(comment);
     2179    mr_free(prompt);
    21802180    return (0);
    21812181}
     
    22092209    sprintf(result_sz, "%s %s", exclude_these_directories,
    22102210            exclude_these_devices);
    2211     paranoid_free(exclude_these_devices);
    2212     paranoid_free(exclude_these_directories);
     2211    mr_free(exclude_these_devices);
     2212    mr_free(exclude_these_directories);
    22132213    return (result_sz);
    22142214}
     
    22382238           ("tr -s '\t' ' ' < /etc/fstab | grep -E '( (coda|ncpfs|nfs|smbfs|cifs|mvfs) )' | cut -d' ' -f1 | tr -s '\n' ' ' | awk '{print $0;}'"));
    22392239    sprintf(result_sz, "%s", exclude_these_directories);
    2240     paranoid_free(exclude_these_devices);
    2241     paranoid_free(exclude_these_directories);
     2240    mr_free(exclude_these_devices);
     2241    mr_free(exclude_these_directories);
    22422242    return (result_sz);
    22432243}
     
    22692269    sprintf(tmp, "chmod 770 %s", store_name_here);
    22702270    paranoid_system(tmp);
    2271     paranoid_free(tmp);
     2271    mr_free(tmp);
    22722272}
    22732273
     
    23232323    sprintf(command, "rm -Rf %s/tmp.mondo.* %s/mondo.scratch.*", tmp, tmp);
    23242324    paranoid_system(command);
    2325     paranoid_free(tmp);
    2326     paranoid_free(command);
    2327     paranoid_free(sz);
     2325    mr_free(tmp);
     2326    mr_free(command);
     2327    mr_free(sz);
    23282328}
    23292329
     
    24042404        cd_number = atoi(last_line_of_file(mountdev));
    24052405//      log_it("cd_number = %d", cd_number);
    2406         paranoid_free(mountdev);
    2407         paranoid_free(tmp);
     2406        mr_free(mountdev);
     2407        mr_free(tmp);
    24082408        return (cd_number);
    24092409    }
     
    24212421        atoi(last_line_of_file(MNT_CDROM "/archives/THIS-CD-NUMBER"));
    24222422//  log_it("cd_number..later.. = %d", cd_number);
    2423     paranoid_free(mountdev);
    2424     paranoid_free(tmp);
     2423    mr_free(mountdev);
     2424    mr_free(tmp);
    24252425    return (cd_number);
    24262426}
     
    25502550    if (!(pdrives = popen(list_drives_cmd, "r"))) {
    25512551        log_OS_error("Unable to open list of drives");
    2552         paranoid_free(list_drives_cmd);
    2553         paranoid_free(current_drive);
     2552        mr_free(list_drives_cmd);
     2553        mr_free(current_drive);
    25542554        return ('\0');
    25552555    }
     
    25732573    }
    25742574    log_it("%d grubs and %d lilos\n", count_grubs, count_lilos);
    2575     paranoid_free(list_drives_cmd);
    2576     paranoid_free(current_drive);
     2575    mr_free(list_drives_cmd);
     2576    mr_free(current_drive);
    25772577    if (count_grubs && !count_lilos) {
    25782578        return ('G');
     
    26742674        log_it("resolved %s to %s", incoming, output);
    26752675    }
    2676     paranoid_free(command);
    2677     paranoid_free(curr_fname);
    2678     paranoid_free(tmp);
     2676    mr_free(command);
     2677    mr_free(curr_fname);
     2678    mr_free(tmp);
    26792679    return (output);
    26802680}
     
    27092709    }
    27102710    log_msg(0, "Found %s partition table format type", output);
    2711     paranoid_free(command);
    2712     paranoid_free(tmp);
    2713     paranoid_free(fdisk);
     2711    mr_free(command);
     2712    mr_free(tmp);
     2713    mr_free(fdisk);
    27142714    return (output);
    27152715}
  • branches/stable/mondo/src/common/libmondo-fifo.c

    r1075 r1080  
    146146    }
    147147
    148     paranoid_free(command);
    149     paranoid_free(tmp);
     148    mr_free(command);
     149    mr_free(tmp);
    150150    return (fres);
    151151}
     
    179179        run_program_and_log_output(command, TRUE);
    180180    }
    181     paranoid_free(tmp);
    182     paranoid_free(command);
     181    mr_free(tmp);
     182    mr_free(command);
    183183}
    184184
  • branches/stable/mondo/src/common/libmondo-filelist.c

    r1075 r1080  
    1818#include "libmondo-tools-EXT.h"
    1919#include "mr_str.h"
     20#include "mr_mem.h"
    2021
    2122#include <time.h>
     
    148149
    149150  end_of_func:
    150     paranoid_free(filelist);
    151     paranoid_free(tempfile);
    152     paranoid_free(cksumlist);
    153     paranoid_free(dev);
    154     paranoid_free(tmp);
     151    mr_free(filelist);
     152    mr_free(tempfile);
     153    mr_free(cksumlist);
     154    mr_free(dev);
     155    mr_free(tmp);
    155156    return (retval);
    156157}
     
    191192        }
    192193    }
    193     paranoid_free(tmp_fname);
    194     paranoid_free(command);
     194    mr_free(tmp_fname);
     195    mr_free(command);
    195196    log_msg(1, "Finished sorting file %s", orig_fname);
    196197    return (retval);
     
    243244    malloc_string(outfname);
    244245    malloc_string(biggie_fname);
    245     incoming = malloc(MAX_STR_LEN * 2);
     246    incoming = mr_malloc(MAX_STR_LEN * 2);
    246247    malloc_string(tmp);
    247248    malloc_string(acl_fname);
     
    364365#endif
    365366  end_of_func:
    366     paranoid_free(outfname);
    367     paranoid_free(biggie_fname);
    368     paranoid_free(incoming);
    369     paranoid_free(tmp);
    370     paranoid_free(acl_fname);
    371     paranoid_free(xattr_fname);
     367    mr_free(outfname);
     368    mr_free(biggie_fname);
     369    mr_free(incoming);
     370    mr_free(tmp);
     371    mr_free(acl_fname);
     372    mr_free(xattr_fname);
    372373    return (err ? 0 : curr_set_no + 1);
    373374}
     
    419420    }
    420421    filelist->ch = '\0';
    421     paranoid_free(filelist);
     422    mr_free(filelist);
    422423    depth--;
    423424    if (depth == 0) {
     
    448449    }
    449450    paranoid_pclose(pattr);
    450     paranoid_free(tmp);
     451    mr_free(tmp);
    451452    return (0);
    452453}
     
    474475        log_msg(1, "Cannot openout auxlist_fname %s", auxlist_fname);
    475476        fclose(fin);
    476         paranoid_free(pout_command);
     477        mr_free(pout_command);
    477478        return (4);
    478479    }
     
    487488        asprintf(&strtmp, syscall_sprintf, mr_stresc(file_to_analyze, "`$\\\"", '\\'));
    488489        asprintf(&syscall, "%s 2>> /dev/null", strtmp); // " MONDO_LOGFILE);
    489         paranoid_free(strtmp);
     490        mr_free(strtmp);
    490491        call_exe_and_pipe_output_to_fd(syscall, pout);
    491         paranoid_free(syscall);
     492        mr_free(syscall);
    492493    }
    493494    paranoid_fclose(fin);
    494495    paranoid_pclose(pout);
    495     paranoid_free(file_to_analyze);
    496     paranoid_free(pout_command);
     496    mr_free(file_to_analyze);
     497    mr_free(pout_command);
    497498    return (0);
    498499}
     
    514515        iamhere(command);
    515516        retval = system(command);
    516         paranoid_free(command);
     517        mr_free(command);
    517518    }
    518519    return (retval);
     
    529530        sprintf(command, "touch %s", fattr_fname);
    530531        run_program_and_log_output(command, 8);
    531         paranoid_free(command);
     532        mr_free(command);
    532533//      sort_file(filelist); // FIXME - filelist chopper sorts, so this isn't necessary
    533534        retval =
     
    561562        log_msg(1, "command = %s", command);
    562563        retval = system(command);
    563         paranoid_free(command);
     564        mr_free(command);
    564565        log_msg(1, "Returning w/ retval=%d", retval);
    565566        return (retval);
     
    569570                "original_exat_fname %s is empty or missing, so no need to set EXAT list",
    570571                original_exat_fname);
    571         paranoid_free(command);
     572        mr_free(command);
    572573        return (0);
    573574    }
     
    679680
    680681    unlink(masklist);
    681     paranoid_free(current_subset_file);
    682     paranoid_free(current_master_file);
    683     paranoid_free(syscall_pout);
    684     paranoid_free(syscall_pin);
    685     paranoid_free(masklist);
    686     paranoid_free(incoming);
    687     paranoid_free(command);
     682    mr_free(current_subset_file);
     683    mr_free(current_master_file);
     684    mr_free(syscall_pout);
     685    mr_free(syscall_pin);
     686    mr_free(masklist);
     687    mr_free(incoming);
     688    mr_free(command);
    688689    return (retval);
    689690}
     
    805806
    806807/* add here */
    807     if (!(newnode = (struct s_node *) malloc(sizeof(struct s_node)))) {
    808         log_to_screen("failed to malloc");
    809         depth--;
    810         return (1);
    811     }
     808    newnode = (struct s_node *) mr_malloc(sizeof(struct s_node));
    812809    if (char_to_add < node->ch) // add to the left of node
    813810    {
     
    835832    log_msg(6, "Adding remaining chars ('%s')", string_to_add + 1);
    836833    for (i = 1; i < noof_chars; i++) {
    837         if (!
    838             (node->down =
    839              (struct s_node *) malloc(sizeof(struct s_node)))) {
    840             log_to_screen("%s - failed to malloc", string_to_add);
    841             return (1);
     834            node->down = (struct s_node *) mr_malloc(sizeof(struct s_node));
    842835        }
    843836        node = node->down;
     
    901894    }
    902895    g_original_noof_lines_in_filelist = lines_in_filelist;
    903     if (!(filelist = (struct s_node *) malloc(sizeof(struct s_node)))) {
    904         return (NULL);
    905     }
     896    filelist = (struct s_node *) mr_malloc(sizeof(struct s_node));
    906897    filelist->ch = '/';
    907898    filelist->right = NULL;
    908     filelist->down = malloc(sizeof(struct s_node));
     899    filelist->down = mr_malloc(sizeof(struct s_node));
    909900    filelist->expanded = filelist->selected = FALSE;
    910901    (filelist->down)->ch = '\0';
     
    13961387        while((token = mr_strtok (sth, delims, &lastpos))) {
    13971388          asprintf(&strtmp,"%s", find_excludes);
    1398           paranoid_free(find_excludes);
     1389          mr_free(find_excludes);
    13991390          asprintf(&find_excludes,"%s -path %s -prune -o", strtmp, token);
    1400           paranoid_free(strtmp);
    1401           paranoid_free(token);
     1391          mr_free(strtmp);
     1392          mr_free(token);
    14021393        }
    14031394#if linux
     
    14121403                dir, MAX_SKEL_DEPTH, find_excludes, g_skeleton_filelist);
    14131404#endif
    1414         paranoid_free(find_excludes);
     1405        mr_free(find_excludes);
    14151406        log_msg(5, "find command = %s", strtmp);
    14161407        system(strtmp);
    1417         paranoid_free(strtmp);
     1408        mr_free(strtmp);
    14181409        sprintf(tmp, "wc -l %s | awk '{print $1;}'", g_skeleton_filelist);
    14191410        g_skeleton_entries =
     
    15201511    if (!depth) {
    15211512        close_evalcall_form();
    1522         paranoid_free(name_of_evalcall_form);
    1523         paranoid_free(find_skeleton_marker);
     1513        mr_free(name_of_evalcall_form);
     1514        mr_free(find_skeleton_marker);
    15241515        unlink(g_skeleton_filelist);
    15251516        log_msg(5, "g_skeleton_entries = %ld", g_skeleton_entries);
    15261517    }
    1527     paranoid_free(tmp);
    1528     paranoid_free(sth_B);
    1529     paranoid_free(ith_B);
    1530     paranoid_free(new_with_spaces);
     1518    mr_free(tmp);
     1519    mr_free(sth_B);
     1520    mr_free(ith_B);
     1521    mr_free(new_with_spaces);
    15311522    return (0);
    15321523}
     
    15931584    malloc_string(sz_filelist);
    15941585    malloc_string(g_skeleton_filelist);
    1595     if (!(exclude_paths = malloc(1000))) {
    1596         fatal_error("Cannot malloc exclude_paths");
    1597     }
     1586    exclude_paths = mr_malloc(1000);
    15981587    log_msg(3, "Trying to write test string to exclude_paths");
    15991588    strcpy(exclude_paths, "/blah /froo");
     
    16881677    paranoid_system(command);
    16891678    log_msg(2, "Freeing variables");
    1690     paranoid_free(sz_filelist);
    1691     paranoid_free(command);
    1692     paranoid_free(exclude_paths);
    1693     paranoid_free(tmp);
    1694     paranoid_free(g_skeleton_filelist);
     1679    mr_free(sz_filelist);
     1680    mr_free(command);
     1681    mr_free(exclude_paths);
     1682    mr_free(tmp);
     1683    mr_free(g_skeleton_filelist);
    16951684    log_msg(2, "Exiting");
    16961685    return (0);
     
    18381827    paranoid_fclose(fout);
    18391828    paranoid_fclose(fin);
    1840     paranoid_free(fname);
    1841     paranoid_free(tmp);
     1829    mr_free(fname);
     1830    mr_free(tmp);
    18421831    return (retval);
    18431832}
     
    18951884    }
    18961885    paranoid_fclose(fin);
    1897     paranoid_free(tmp);
     1886    mr_free(tmp);
    18981887    return (0);
    18991888}
  • branches/stable/mondo/src/common/libmondo-files.c

    r1075 r1080  
    282282            fatal_error("Mindi gave a fatal error. Please check '/var/log/mindi.log'.");
    283283        }
    284         paranoid_free(command);
     284        mr_free(command);
    285285    }
    286286    log_it("Calling Mindi with kernel path of '%s'", kernel);
     
    334334    if (incoming[0] == '\0') {
    335335        if (system("which file > /dev/null 2> /dev/null")) {
    336             paranoid_free(incoming);
    337             paranoid_free(command);
     336            mr_free(incoming);
     337            mr_free(command);
    338338            output[0] = '\0';
    339339            return (NULL);      // forget it :)
     
    359359        log_msg(4, "find_home_of_exe() --- Could not find %s", fname);
    360360    }
    361     paranoid_free(incoming);
    362     paranoid_free(command);
     361    mr_free(incoming);
     362    mr_free(command);
    363363    if (!output[0]) {
    364364        return (NULL);
     
    865865    paranoid_fclose(fin);
    866866    log_it("Finished calculating total size of all biggiefiles");
    867     paranoid_free(fname);
    868     paranoid_free(biggielist);
    869     paranoid_free(comment);
    870     paranoid_free(tmp);
    871     paranoid_free(command);
     867    mr_free(fname);
     868    mr_free(biggielist);
     869    mr_free(comment);
     870    mr_free(tmp);
     871    mr_free(command);
    872872    return (scratchL);
    873873}
     
    14031403        retval = 1;
    14041404    }
    1405     paranoid_free(tmp);
     1405    mr_free(tmp);
    14061406    return (retval);
    14071407}
  • branches/stable/mondo/src/common/libmondo-fork.c

    r1075 r1080  
    55
    66#include "my-stuff.h"
     7#include "mr_mem.h"
    78#include "mondostructures.h"
    89#include "libmondo-fork.h"
     
    106107    assert_string_is_neither_NULL_nor_zerolength(isofile);
    107108    assert_string_is_neither_NULL_nor_zerolength(logstub);
    108     if (!(midway_call = malloc(1200))) {
    109         fatal_error("Cannot malloc midway_call");
    110     }
    111     if (!(ultimate_call = malloc(1200))) {
    112         fatal_error("Cannot malloc ultimate_call");
    113     }
    114     if (!(tmp = malloc(1200))) {
    115         fatal_error("Cannot malloc tmp");
    116     }
    117     if (!(command = malloc(1200))) {
    118         fatal_error("Cannot malloc command");
    119     }
     109    midway_call = mr_malloc(1200);
     110    ultimate_call = mr_malloc(1200);
     111    tmp = mr_malloc(1200);
     112    command = mr_malloc(1200);
    120113    malloc_string(incoming);
    121114    malloc_string(old_stderr);
     
    178171    }
    179172
    180     paranoid_free(midway_call);
    181     paranoid_free(ultimate_call);
    182     paranoid_free(tmp);
    183     paranoid_free(command);
    184     paranoid_free(incoming);
    185     paranoid_free(old_stderr);
    186     paranoid_free(cd_number_str);
     173    mr_free(midway_call);
     174    mr_free(ultimate_call);
     175    mr_free(tmp);
     176    mr_free(command);
     177    mr_free(incoming);
     178    mr_free(old_stderr);
     179    mr_free(cd_number_str);
    187180/*
    188181  if (bkpinfo->backup_media_type == dvd && !bkpinfo->please_dont_eject_when_restoring)
     
    424417    tmp[0] = '\0';
    425418    bufcap = 256L * 1024L;
    426     if (!(buf = malloc(bufcap))) {
    427         fatal_error("Failed to malloc() buf");
    428     }
     419    buf = mr_malloc(bufcap);
    429420
    430421    if (direction == 'w') {
     
    529520    }
    530521
    531     paranoid_free(buf);
    532     paranoid_free(tmp);
     522    mr_free(buf);
     523    mr_free(tmp);
    533524    log_msg(3, "Successfully copied %ld bytes", bytes_written_out);
    534525    return (retval);
     
    559550    sprintf(command, "ntfsclone --force --save-image --overwrite %s %s", output_fname, input_device);
    560551    res = run_program_and_log_output(command, 5);
    561     paranoid_free(command);
     552    mr_free(command);
    562553    unlink(output_fname);
    563554    return (res);
     
    627618    }
    628619    unlink(tempfile);
    629     paranoid_free(command);
    630     paranoid_free(tempfile);
    631     paranoid_free(title);
     620    mr_free(command);
     621    mr_free(tempfile);
     622    mr_free(title);
    632623    return (res);
    633624}
     
    721712    }
    722713    log_msg(3, "Parent res = %d", res);
    723     paranoid_free(command);
    724     paranoid_free(title);
     714    mr_free(command);
     715    mr_free(title);
    725716    return (res);
    726717}
     
    747738    sprintf(command, "ntfsclone --force --restore-image --overwrite %s %s", output_device, input_fifo);
    748739    res = run_program_and_log_output(command, 5);
    749     paranoid_free(command);
     740    mr_free(command);
    750741    return (res);
    751742}
  • branches/stable/mondo/src/common/libmondo-mountlist.c

    r1075 r1080  
    1 /* libmondo-mountlist.c                            subroutines for handling mountlist
     1/* subroutines for handling mountlist
    22   $Id$
    33*/
     
    1818#include "libmondo-string-EXT.h"
    1919#include "libmondo-gui-EXT.h"
     20#include "mr_mem.h"
    2021
    2122/*@unused@*/
     
    488489
    489490  endoffunc:
    490     paranoid_free(tmp);
    491     paranoid_free(device);
    492     paranoid_free(mountpoint);
     491    mr_free(tmp);
     492    mr_free(device);
     493    mr_free(mountpoint);
    493494
    494495    if (res) {
     
    528529    /*@ initialize ******************************************************* */
    529530
    530     drivelist = malloc(sizeof(struct list_of_disks));
     531    drivelist = mr_malloc(sizeof(struct list_of_disks));
    531532    malloc_string(tmp);
    532533    malloc_string(flaws_str);
     
    591592         && strcmp(mountlist->el[i].device, device) != 0; i++);
    592593
    593     paranoid_free(tmp);
    594     paranoid_free(flaws_str);
     594    mr_free(tmp);
     595    mr_free(flaws_str);
    595596
    596597    if (i == mountlist->entries) {
     
    651652        }
    652653    }
    653     paranoid_free(curr_mountpoint);
    654     paranoid_free(tmp);
     654    mr_free(curr_mountpoint);
     655    mr_free(tmp);
    655656    return (res);
    656657}
     
    702703        }
    703704    }
    704     paranoid_free(tmp);
    705     paranoid_free(format_sz);
     705    mr_free(tmp);
     706    mr_free(format_sz);
    706707    return (res);
    707708}
     
    783784    drivelist->entries = noof_drives;
    784785    log_msg(8, "Made list of drives");
    785     paranoid_free(drive);
    786     paranoid_free(tmp);
     786    mr_free(drive);
     787    mr_free(tmp);
    787788
    788789    return (noof_drives);
     
    844845    output_list->entries = items;
    845846    log_it("MLUORP -- ending");
    846     paranoid_free(tmp);
     847    mr_free(tmp);
    847848}
    848849
     
    911912        log_it("Unable to open mountlist - '%s'", fname);
    912913        log_to_screen("Cannot open mountlist");
    913         paranoid_free(incoming);
    914         paranoid_free(siz);
    915         paranoid_free(tmp);
     914        mr_free(incoming);
     915        mr_free(siz);
     916        mr_free(tmp);
    916917        return (1);
    917918    }
     
    9991000    sprintf(tmp, "%d entries in mountlist", items);
    10001001    log_it(tmp);
    1001     paranoid_free(incoming);
    1002     paranoid_free(siz);
    1003     paranoid_free(tmp);
     1002    mr_free(incoming);
     1003    mr_free(siz);
     1004    mr_free(tmp);
    10041005    return (0);
    10051006}
  • branches/stable/mondo/src/common/libmondo-raid.c

    r1075 r1080  
    1818#include "libmondo-raid.h"
    1919#include "mr_str.h"
     20#include "mr_mem.h"
    2021
    2122#ifdef __FreeBSD__
     
    4950    int res;
    5051
    51     command = malloc(MAX_STR_LEN * 2);
     52    command = mr_malloc(MAX_STR_LEN * 2);
    5253    strcpy(command, "grep \" /proc/mdstat");
    5354    if (raidno == -1) {
     
    5960    log_it("Is raid %d registered? Command = '%s'", raidno, command);
    6061    res = system(command);
    61     paranoid_free(command);
     62    mr_free(command);
    6263    if (res) {
    6364        return (FALSE);
     
    200201    strcpy(raidrec->additional_vars.el[lino].label, label);
    201202    strcpy(raidrec->additional_vars.el[lino].value, sz_value);
    202     paranoid_free(sz_value);
     203    mr_free(sz_value);
    203204}
    204205#endif
     
    436437    label[0] = value[0] = '\0';
    437438    if (feof(fin)) {
    438         paranoid_free(incoming);
     439        mr_free(incoming);
    439440        return (1);
    440441    }
     
    452453        strcpy(label, incoming);
    453454        strcpy(value, p);
    454         paranoid_free(incoming);
     455        mr_free(incoming);
    455456        return (0);
    456457    }
     
    480481        log_it("Raidtab is very small or non-existent. Ignoring it.");
    481482        raidlist->entries = 0;
    482         paranoid_free(tmp);
     483        mr_free(tmp);
    483484        return (0);
    484485    }
    485486    if (!(fin = fopen(fname, "r"))) {
    486487        log_it("Cannot open raidtab");
    487         paranoid_free(tmp);
     488        mr_free(tmp);
    488489        return (1);
    489490    }
     
    590591    sprintf(tmp, "%d RAID devices in raidtab", raidlist->entries);
    591592    log_it(tmp);
    592     paranoid_free(tmp);
     593    mr_free(tmp);
    593594    return (0);
    594595}
     
    616617        log_it("Raidtab is very small or non-existent. Ignoring it.");
    617618        raidlist->entries = 0;
    618         paranoid_free(tmp);
    619         paranoid_free(label);
    620         paranoid_free(value);
     619        mr_free(tmp);
     620        mr_free(label);
     621        mr_free(value);
    621622        return (0);
    622623    }
    623624    if (!(fin = fopen(fname, "r"))) {
    624625        log_it("Cannot open raidtab");
    625         paranoid_free(tmp);
    626         paranoid_free(label);
    627         paranoid_free(value);
     626        mr_free(tmp);
     627        mr_free(label);
     628        mr_free(value);
    628629        return (1);
    629630    }
     
    661662    log_msg(1, "Raidtab loaded successfully.");
    662663    log_msg(1, "%d RAID devices in raidtab", items);
    663     paranoid_free(tmp);
    664     paranoid_free(label);
    665     paranoid_free(value);
     664    mr_free(tmp);
     665    mr_free(label);
     666    mr_free(value);
    666667    return (0);
    667668}
     
    762763        raidrec->additional_vars.entries = ++v;
    763764    }
    764     paranoid_free(tmp);
    765     paranoid_free(labelB);
    766     paranoid_free(valueB);
     765    mr_free(tmp);
     766    mr_free(labelB);
     767    mr_free(valueB);
    767768}
    768769#endif
     
    820821    static char *argv[64];
    821822    char **ap;
    822     char *line = (char *) malloc(MAX_STR_LEN);
    823     if (!line)
    824         errx(1,
    825              "unable to allocate %i bytes of memory for `char *line' at %s:%i",
    826              MAX_STR_LEN, __FILE__, __LINE__);
     823    char *line = (char *) mr_malloc(MAX_STR_LEN);
    827824    (void) fgets(line, MAX_STR_LEN, f);
    828825    if (feof(f)) {
     
    868865    int i, j;
    869866    static char **ret;
    870     ret = (char **) malloc(nval * sizeof(char *));
     867    ret = (char **) mr_malloc(nval * sizeof(char *));
    871868    for (i = 0; i < (argc - nval); ++i) {
    872869        if (!strcmp(argv[i], option)) {
    873870            for (j = 0; j < nval; ++j) {
    874                 ret[j] = (char *) malloc(strlen(argv[i + j + 1]) + 1);
     871                ret[j] = (char *) mr_malloc(strlen(argv[i + j + 1]) + 1);
    875872                strcpy(ret[j], argv[i + j + 1]);
    876873            }
     
    10141011    asprintf(&strtmp, pos);
    10151012    strcpy(string, strtmp);
    1016     paranoid_free(strtmp);
     1013    mr_free(strtmp);
    10171014    // if we have newline after only spaces, this is a blank line, update
    10181015    // counters, otherwise do normal parsing
     
    10351032    asprintf(&strtmp,"%s%s", device_prefix, token);
    10361033    strcpy(raidlist->el[raidlist->entries].raid_device, strtmp);
    1037     paranoid_free(strtmp);
    1038     paranoid_free(token);
     1034    mr_free(strtmp);
     1035    mr_free(token);
    10391036    // skip ':' and status
    10401037    token = mr_strtok (string, delims, &lastpos);
    1041     paranoid_free(token);
     1038    mr_free(token);
    10421039    token = mr_strtok (string, delims, &lastpos);
    10431040    if (!strcmp(token, "inactive")) {
    10441041      log_msg(1, "RAID device '%s' inactive.\n",
    10451042         raidlist->el[raidlist->entries].raid_device);
    1046       paranoid_free(string);
    1047       paranoid_free(token);
     1043      mr_free(string);
     1044      mr_free(token);
    10481045      return 1;
    10491046    }
    1050     paranoid_free(token);
     1047    mr_free(token);
    10511048
    10521049    // get RAID level
     
    10701067    } else {
    10711068      log_msg(1, "Unknown RAID level '%s'.\n", token);
    1072       paranoid_free(string);
    1073       paranoid_free(token);
     1069      mr_free(string);
     1070      mr_free(token);
    10741071      return 1;
    10751072    }
    1076     paranoid_free(token);
     1073    mr_free(token);
    10771074
    10781075    // get RAID devices (type, index, device)
     
    10941091        asprintf(&strtmp,"%s%s", device_prefix, token);
    10951092        strcpy(raidlist->el[raidlist->entries].data_disks.el[raidlist->el[raidlist->entries].data_disks.entries].device, strtmp);
    1096         paranoid_free(strtmp);
     1093        mr_free(strtmp);
    10971094        raidlist->el[raidlist->entries].data_disks.entries++;
    10981095        break;
     
    11011098        asprintf(&strtmp,"%s%s", device_prefix, token);
    11021099        strcpy(raidlist->el[raidlist->entries].spare_disks.el[raidlist->el[raidlist->entries].spare_disks.entries].device, strtmp);
    1103         paranoid_free(strtmp);
     1100        mr_free(strtmp);
    11041101        raidlist->el[raidlist->entries].spare_disks.entries++;
    11051102        break;
     
    11081105        asprintf(&strtmp,"%s%s", device_prefix, token);
    11091106        strcpy(raidlist->el[raidlist->entries].failed_disks.el[raidlist->el[raidlist->entries].failed_disks.entries].device, strtmp);
    1110         paranoid_free(strtmp);
     1107        mr_free(strtmp);
    11111108        raidlist->el[raidlist->entries].failed_disks.entries++;
    11121109        log_it("At least one failed disk found in RAID array.\n");
     
    11141111      default: // error
    11151112        log_msg(1, "Unknown device type '%c'\n", type);
    1116         paranoid_free(string);
    1117         paranoid_free(token);
     1113        mr_free(string);
     1114        mr_free(token);
    11181115        return 1;
    11191116        break;
    11201117      }
    1121       paranoid_free(token);
     1118      mr_free(token);
    11221119    }
    11231120
     
    11721169        if (pos < string) {
    11731170          log_it("String underflow!\n");
    1174           paranoid_free(string);
     1171          mr_free(string);
    11751172          return 1;
    11761173        }
     
    11971194        if (pos < string) {
    11981195          printf("ERROR: String underflow!\n");
    1199           paranoid_free(string);
     1196          mr_free(string);
    12001197          return 1;
    12011198        }
     
    12141211  fclose(fin);
    12151212  // free string
    1216   paranoid_free(string);
     1213  mr_free(string);
    12171214  // return success
    12181215  return 0;
     
    12281225    int retval = 0;
    12291226
    1230     raidlist = malloc(sizeof(struct raidlist_itself));
     1227    raidlist = mr_malloc(sizeof(struct raidlist_itself));
    12311228
    12321229    // FIXME: Prefix '/dev/' should really be dynamic!
  • branches/stable/mondo/src/common/libmondo-stream.c

    r1075 r1080  
    1313
    1414#include "my-stuff.h"
     15#include "mr_mem.h"
    1516#include "mondostructures.h"
    1617#include "libmondo-devices.h"
     
    111112    int i;
    112113
    113     blk = (char *) malloc(256 * 1024);
     114    blk = (char *) mr_malloc(256 * 1024);
    114115
    115116    log_it("closein_tape() -- entering");
     
    141142        eject_device(bkpinfo->media_device);
    142143    }
    143     paranoid_free(blk);
    144     paranoid_free(g_tapecatalog);
     144    mr_free(blk);
     145    mr_free(g_tapecatalog);
    145146    return (retval);
    146147}
     
    170171    char *blk;
    171172
    172     blk = (char *) malloc(256 * 1024);
     173    blk = (char *) mr_malloc(256 * 1024);
    173174
    174175    sleep(1);
     
    218219    //  if (!bkpinfo->please_dont_eject)
    219220    //    { eject_device(bkpinfo->media_device); }
    220     paranoid_free(blk);
    221     paranoid_free(g_tapecatalog);
     221    mr_free(blk);
     222    mr_free(g_tapecatalog);
    222223    return (retval);
    223224}
     
    233234    sprintf(command, "mt -f %s status", dev);
    234235    res = run_program_and_log_output(command, 1);
    235     paranoid_free(command);
     236    mr_free(command);
    236237    if (res) {
    237238        return (FALSE);
     
    596597    sprintf(tmp, "mt -f %s setblk %ld", tapedev, internal_tape_block_size);
    597598    res = run_program_and_log_output(tmp, 3);
    598     paranoid_free(tmp);
     599    mr_free(tmp);
    599600    return (res);
    600601}
     
    636637
    637638    assert_string_is_neither_NULL_nor_zerolength(bkpinfo->media_device);
    638     if (!(g_tapecatalog = malloc(sizeof(struct s_tapecatalog)))) {
    639         fatal_error("Cannot alloc mem for tape catalog");
    640     }
     639    g_tapecatalog = mr_malloc(sizeof(struct s_tapecatalog));
    641640    g_tapecatalog->entries = 0;
    642641    g_tape_posK = 0;
     
    672671        return (-1);
    673672    }
    674     if (!(datablock = (char *) malloc(256 * 1024))) {
    675         log_to_screen("Unable to malloc 256*1024");
    676         exit(1);
    677     }
     673    datablock = (char *) mr_malloc(256 * 1024);
    678674    for (i = 0; i < 32; i++) {
    679675        for (j = 0; j < 4; j++) {
     
    692688    }
    693689    paranoid_fclose(fout);
    694     paranoid_free(datablock);
     690    mr_free(datablock);
    695691/* find initial blocks */
    696692    res = read_header_block_from_stream(&size, fname, &ctrl_chr);
     
    738734/*  initialise the catalog */
    739735    g_current_media_number = 1;
    740     if (!(g_tapecatalog = malloc(sizeof(struct s_tapecatalog)))) {
    741         fatal_error("Cannot alloc mem for tape catalog");
    742     }
     736    g_tapecatalog = mr_malloc(sizeof(struct s_tapecatalog));
    743737    g_tapecatalog->entries = 0;
    744738/* log stuff */
     
    771765        return (0);
    772766    }
    773     if (!(g_tapecatalog = malloc(sizeof(struct s_tapecatalog)))) {
    774         fatal_error("Cannot alloc mem for tape catalog");
    775     }
     767    g_tapecatalog = mr_malloc(sizeof(struct s_tapecatalog));
    776768    g_tapecatalog->entries = 0;
    777769    g_tape_posK = 0;
     
    898890    malloc_string(temp_cksum);
    899891    malloc_string(actual_cksum);
    900     datablock = malloc(TAPE_BLOCK_SIZE);
     892    datablock = mr_malloc(TAPE_BLOCK_SIZE);
    901893    crc16 = 0;
    902894    crctt = 0;
     
    995987        /*      log_it(tmp); */
    996988    }
    997     paranoid_free(datablock);
    998     paranoid_free(tmp);
    999     paranoid_free(temp_fname);
    1000     paranoid_free(temp_cksum);
    1001     paranoid_free(actual_cksum);
     989    mr_free(datablock);
     990    mr_free(tmp);
     991    mr_free(temp_fname);
     992    mr_free(temp_cksum);
     993    mr_free(actual_cksum);
    1002994    return (retval);
    1003995}
     
    10281020    /*@ end vars *************************************************** */
    10291021
    1030     tempblock = (char *) malloc((size_t) TAPE_BLOCK_SIZE);
     1022    tempblock = (char *) mr_malloc((size_t) TAPE_BLOCK_SIZE);
    10311023
    10321024    for (i = 0; i < (int) TAPE_BLOCK_SIZE; i++) {
     
    10651057            marker_to_string(*pcontrol_char), tempblock + 1000,
    10661058            (long) (*plen) >> 10);
    1067     paranoid_free(tempblock);
     1059    mr_free(tempblock);
    10681060    return (retval);
    10691061}
     
    11721164    long bytes_to_write;
    11731165
    1174     datablock = malloc(TAPE_BLOCK_SIZE);
     1166    datablock = mr_malloc(TAPE_BLOCK_SIZE);
    11751167    malloc_string(temp_fname);
    11761168    pB = strrchr(the_file_I_was_reading, '/');
     
    12651257    log_msg(2, "Reading %s (it matches %s)", temp_fname,
    12661258            the_file_I_was_reading);
    1267     paranoid_free(temp_fname);
    1268     paranoid_free(datablock);
     1259    mr_free(temp_fname);
     1260    mr_free(datablock);
    12691261    return (0);
    12701262}
     
    13131305        log_msg(3, "Next tape opened OK. Whoopee!");
    13141306    }
    1315     paranoid_free(sz_msg);
     1307    mr_free(sz_msg);
    13161308    return (res);
    13171309}
     
    14131405        }
    14141406    }
    1415     paranoid_free(fname);
     1407    mr_free(fname);
    14161408    log_msg(2, "Finished writing back catalog to tape");
    14171409    return (res);
  • branches/stable/mondo/src/common/libmondo-string.c

    r1063 r1080  
    88
    99#include "my-stuff.h"
     10#include "mr_mem.h"
    1011#include "mondostructures.h"
    1112#include "libmondo-string.h"
     
    220221    malloc_string(tmp);
    221222    if (!incoming[0]) {
    222         free(tmp);
     223        mr_free(tmp);
    223224        return (0);
    224225    }
     
    254255        fatal_error(tmp);
    255256    }
    256     paranoid_free(tmp);
     257    mr_free(tmp);
    257258    return (outval);
    258259}
     
    512513    char *p;
    513514
    514     input = malloc(2000);
     515    input = mr_malloc(2000);
    515516    assert_string_is_neither_NULL_nor_zerolength(ip);
    516517    assert_string_is_neither_NULL_nor_zerolength(token);
     
    526527        strcat(output, p);
    527528    }
    528     paranoid_free(input);
     529    mr_free(input);
    529530}
    530531
     
    796797    }
    797798    in_out[i] = '\0';
    798     paranoid_free(tmp);
     799    mr_free(tmp);
    799800/*  for(i=strlen(in_out); i>0 && in_out[i-1]<=32; i--) {in_out[i-1]='\0';} */
    800801}
     
    10181019        strcpy(out_reason, reason);
    10191020    }
    1020     paranoid_free(filename);
    1021     paranoid_free(reason);
     1021    mr_free(filename);
     1022    mr_free(reason);
    10221023    return (sev);
    10231024}
     
    11121113    j = (int) strlen(outstr);
    11131114    sprintf(outstr + j, "] %d%% used", percentage);
    1114     paranoid_free(pos_w_commas);
    1115     paranoid_free(tmp);
     1115    mr_free(pos_w_commas);
     1116    mr_free(tmp);
    11161117    return (outstr);
    11171118}
  • branches/stable/mondo/src/common/libmondo-tools.c

    r1075 r1080  
    1010
    1111#include "my-stuff.h"
     12#include "mr_mem.h"
    1213#include "mondostructures.h"
    1314#include "lib-common-externs.h"
     
    175176else { print $0;};}' $file.old  > $file ; fi ; done");
    176177    run_program_and_log_output(tmp, 5);
    177     paranoid_free(tmp);
     178    mr_free(tmp);
    178179}
    179180
     
    724725    chmod(bkpinfo->tmpdir, 0700);
    725726    g_backup_media_type = bkpinfo->backup_media_type;
    726     paranoid_free(mtpt);
    727     paranoid_free(extra_cdrom_params);
    728     paranoid_free(mondo_mkisofs_sz);
    729     paranoid_free(command);
    730     paranoid_free(hostname);
    731     paranoid_free(ip_address);
    732     paranoid_free(cdr_exe);
    733     paranoid_free(tmp);
    734     paranoid_free(iso_dev);
    735     paranoid_free(iso_mnt);
    736     paranoid_free(iso_tmp);
    737     paranoid_free(iso_path);
     727    mr_free(mtpt);
     728    mr_free(extra_cdrom_params);
     729    mr_free(mondo_mkisofs_sz);
     730    mr_free(command);
     731    mr_free(hostname);
     732    mr_free(ip_address);
     733    mr_free(cdr_exe);
     734    mr_free(tmp);
     735    mr_free(iso_dev);
     736    mr_free(iso_mnt);
     737    mr_free(iso_tmp);
     738    mr_free(iso_path);
    738739    return (retval);
    739740}
     
    13901391    }
    13911392    depth--;
    1392     paranoid_free(tmp);
     1393    mr_free(tmp);
    13931394}
    13941395
     
    14041405 * @bug This function seems orphaned. Please remove.
    14051406 */
    1406 #define do_alloc_or_free_depending(x,y) { if(y) {x=malloc(MAX_STR_LEN);} else {paranoid_free(x);} }
     1407#define do_alloc_or_free_depending(x,y) { if(y) {x=mr_malloc(MAX_STR_LEN);} else {mr_free(x);} }
    14071408
    14081409/**
     
    14221423    } else {
    14231424        iamhere("Freeing globals");
    1424         paranoid_free(g_boot_mountpt);
    1425         paranoid_free(g_mondo_home);
    1426         paranoid_free(g_tmpfs_mountpt);
    1427         paranoid_free(g_erase_tmpdir_and_scratchdir);
    1428         paranoid_free(g_serial_string);
    1429         paranoid_free(g_magicdev_command);
     1425        mr_free(g_boot_mountpt);
     1426        mr_free(g_mondo_home);
     1427        mr_free(g_tmpfs_mountpt);
     1428        mr_free(g_erase_tmpdir_and_scratchdir);
     1429        mr_free(g_serial_string);
     1430        mr_free(g_magicdev_command);
    14301431    }
    14311432
     
    15091510        paranoid_system(tmp);
    15101511    }
    1511     paranoid_free(tmp);
     1512    mr_free(tmp);
    15121513}
    15131514
  • branches/stable/mondo/src/common/libmondo-verify.c

    r1075 r1080  
    99
    1010#include "my-stuff.h"
     11#include "mr_mem.h"
    1112#include "mondostructures.h"
    1213#include "libmondo-verify.h"
     
    5960    long afio_diffs = 0;
    6061
    61     command = malloc(2000);
    62     afio_found_changes = malloc(500);
     62    command = mr_malloc(2000);
     63    afio_found_changes = mr_malloc(500);
    6364    assert_string_is_neither_NULL_nor_zerolength(changedfiles_fname);
    6465    assert_string_is_neither_NULL_nor_zerolength(ignorefiles_fname);
     
    100101    log_msg(2, command);
    101102    paranoid_system(command);
    102     paranoid_free(command);
    103     paranoid_free(afio_found_changes);
     103    mr_free(command);
     104    mr_free(afio_found_changes);
    104105    return (afio_diffs);
    105106}
     
    179180    g_last_afioball_number = set_number - 1;
    180181    close_evalcall_form();
    181     paranoid_free(tmp);
     182    mr_free(tmp);
    182183    return (retval);
    183184}
     
    229230    malloc_string(sz_exe);
    230231    if (!bufblkA) {
    231         if (!(bufblkA = malloc(maxbufsize))) {
    232             fatal_error("Cannot malloc bufblkA");
    233         }
     232        bufblkA = mr_malloc(maxbufsize);
    234233    }
    235234    if (!bufblkB) {
    236         if (!(bufblkB = malloc(maxbufsize))) {
    237             fatal_error("Cannot malloc bufblkB");
    238         }
     235        bufblkB = mr_malloc(maxbufsize);
    239236    }
    240237
     
    369366    close_evalcall_form();
    370367    if (bufblkA) {
    371         paranoid_free(bufblkA);
     368        mr_free(bufblkA);
    372369    }
    373370    if (bufblkB) {
    374         paranoid_free(bufblkB);
    375     }
    376     paranoid_free(tmp);
    377     paranoid_free(command);
    378     paranoid_free(sz_exe);
    379     paranoid_free(mountpoint);
     371        mr_free(bufblkB);
     372    }
     373    mr_free(tmp);
     374    mr_free(command);
     375    mr_free(sz_exe);
     376    mr_free(mountpoint);
    380377    return (0);
    381378}
     
    413410
    414411
    415     command = malloc(2000);
     412    command = mr_malloc(2000);
    416413    malloc_string(outlog);
    417414    malloc_string(tmp);
     
    506503    //  paranoid_system (tmp);
    507504    //  unlink ("/tmp/mondo-verify.err");
    508     paranoid_free(command);
    509     paranoid_free(outlog);
    510     paranoid_free(tmp);
     505    mr_free(command);
     506    mr_free(outlog);
     507    mr_free(tmp);
    511508    return (0);
    512509}
     
    596593    }
    597594    unlink(tarball_fname);
    598     paranoid_free(tmp);
    599     paranoid_free(tarball_fname);
     595    mr_free(tmp);
     596    mr_free(tarball_fname);
    600597    return (retval);
    601598}
     
    688685        }
    689686    }
    690     paranoid_free(test_file);
    691     paranoid_free(biggie_cksum);
    692     paranoid_free(orig_cksum);
    693     paranoid_free(tmp);
    694     paranoid_free(slice_fnam);
     687    mr_free(test_file);
     688    mr_free(biggie_cksum);
     689    mr_free(orig_cksum);
     690    mr_free(tmp);
     691    mr_free(slice_fnam);
    695692    return (retval);
    696693}
     
    798795    log_msg(1, "All done with afioballs");
    799796    close_progress_form();
    800     paranoid_free(tmp);
    801     paranoid_free(fname);
    802     paranoid_free(curr_xattr_list_fname);
    803     paranoid_free(curr_acl_list_fname);
     797    mr_free(tmp);
     798    mr_free(fname);
     799    mr_free(curr_xattr_list_fname);
     800    mr_free(curr_acl_list_fname);
    804801    return (retval);
    805802}
     
    900897    }
    901898    close_progress_form();
    902     paranoid_free(orig_fname);
    903     paranoid_free(logical_fname);
    904     paranoid_free(curr_xattr_list_fname);
    905     paranoid_free(curr_acl_list_fname);
    906     paranoid_free(comment);
    907     paranoid_free(tmp);
     899    mr_free(orig_fname);
     900    mr_free(logical_fname);
     901    mr_free(curr_xattr_list_fname);
     902    mr_free(curr_acl_list_fname);
     903    mr_free(comment);
     904    mr_free(tmp);
    908905    return (retval);
    909906}
     
    946943#endif
    947944
    948     command = malloc(2000);
     945    command = mr_malloc(2000);
    949946    malloc_string(mountpoint);
    950947    malloc_string(tmp);
     
    10371034        }
    10381035    }
    1039     paranoid_free(command);
    1040     paranoid_free(mountpoint);
    1041     paranoid_free(tmp);
    1042     paranoid_free(fname);
     1036    mr_free(command);
     1037    mr_free(mountpoint);
     1038    mr_free(tmp);
     1039    mr_free(fname);
    10431040    return (retval);
    10441041}
  • branches/stable/mondo/src/common/newt-specific.c

    r1075 r1080  
    1919
    2020#include "my-stuff.h"
     21#include "mr_mem.h"
    2122#include "mondostructures.h"
    2223#include "newt-specific.h"
     
    120121        int i;
    121122
    122          tmp = malloc(MAX_NEWT_COMMENT_LEN);
     123         tmp = mr_malloc(MAX_NEWT_COMMENT_LEN);
    123124         assert_string_is_neither_NULL_nor_zerolength(prompt);
    124125
     
    138139                }
    139140                if (strstr("yesYES", tmp)) {
    140                     paranoid_free(tmp);
     141                    mr_free(tmp);
    141142                    return (TRUE);
    142143                } else if (strstr("NOno", tmp)) {
    143                     paranoid_free(tmp);
     144                    mr_free(tmp);
    144145                    return (FALSE);
    145146                } else {
     
    150151            }
    151152        } else {
    152             paranoid_free(tmp);
     153            mr_free(tmp);
    153154            return (popup_with_buttons(prompt, "Yes", "No"));
    154155        }
     
    168169        int i;
    169170
    170         tmp = malloc(MAX_NEWT_COMMENT_LEN);
     171        tmp = mr_malloc(MAX_NEWT_COMMENT_LEN);
    171172        assert_string_is_neither_NULL_nor_zerolength(prompt);
    172173        if (g_text_mode) {
     
    184185            }
    185186            if (strstr("okOKOkYESyes", tmp)) {
    186                 paranoid_free(tmp);
     187                mr_free(tmp);
    187188                return (TRUE);
    188189            } else {
    189                 paranoid_free(tmp);
     190                mr_free(tmp);
    190191                return (FALSE);
    191192            }
    192193        } else {
    193             paranoid_free(tmp);
     194            mr_free(tmp);
    194195            return (popup_with_buttons(prompt, " Okay ", "Cancel"));
    195196        }
     
    259260asprintf(&tmp,"kill `ps %s | grep \" %s \" | awk '{print %s;}' | grep -vx \"\\?\"`", ps_options, str , ps_proc_id);
    260261run_program_and_log_output(tmp, TRUE);
    261 paranoid_free(tmp);
     262mr_free(tmp);
    262263}
    263264
     
    281282
    282283        malloc_string(command);
    283         tmp = malloc(MAX_NEWT_COMMENT_LEN);
     284        tmp = mr_malloc(MAX_NEWT_COMMENT_LEN);
    284285        set_signals(FALSE);     // link to external func
    285286        g_exiting = TRUE;
     
    289290            log_msg(2, "mastermind %d is exiting", (int) getpid());
    290291            kill(g_main_pid, SIGTERM);
    291             paranoid_free(tmp);
     292            mr_free(tmp);
    292293            finish(1);
    293294        }
     
    297298                log_msg(2, "non-m/m %d is exiting", (int) getpid());
    298299                kill(g_main_pid, SIGTERM);
    299                 paranoid_free(tmp);
     300                mr_free(tmp);
    300301                finish(1);
    301302            }
     
    305306        if (already_exiting) {
    306307            log_msg(3, "...I'm already exiting. Give me time, Julian!");
    307             paranoid_free(tmp);
     308            mr_free(tmp);
    308309            finish(1);
    309310        }
     
    360361            log_msg(3, "FYI - g_main_pid is blank");
    361362        }
    362         paranoid_free(tmp);
    363         paranoid_free(command);
     363        mr_free(tmp);
     364        mr_free(command);
    364365        finish(254);
    365366    }
     
    445446
    446447        if (!does_file_exist(filename)) {
    447             paranoid_free(command);
    448             paranoid_free(tmp);
     448            mr_free(command);
     449            mr_free(tmp);
    449450            return;
    450451        }
     
    478479        }
    479480        refresh_log_screen();
    480         paranoid_free(command);
    481         paranoid_free(tmp);
     481        mr_free(command);
     482        mr_free(tmp);
    482483    }
    483484
     
    533534            refresh_log_screen();
    534535        }
    535         paranoid_free(output);
     536        mr_free(output);
    536537    }
    537538
     
    606607        }
    607608        update_evalcall_form(0);
    608         paranoid_free(tmp);
    609         paranoid_free(title);
     609        mr_free(tmp);
     610        mr_free(title);
    610611    }
    611612
     
    680681        }
    681682        update_progress_form_full(blurb1, blurb2, blurb3);
    682         paranoid_free(b1c);
    683         paranoid_free(blurb1);
    684         paranoid_free(blurb2);
    685         paranoid_free(blurb3);
     683        mr_free(b1c);
     684        mr_free(blurb1);
     685        mr_free(blurb2);
     686        mr_free(blurb3);
    686687    }
    687688
     
    733734        char *original_contents;
    734735
    735         blurb = malloc(MAX_NEWT_COMMENT_LEN);
    736         original_contents = malloc(MAX_NEWT_COMMENT_LEN);
     736        blurb = mr_malloc(MAX_NEWT_COMMENT_LEN);
     737        original_contents = mr_malloc(MAX_NEWT_COMMENT_LEN);
    737738        assert_string_is_neither_NULL_nor_zerolength(title);
    738739        assert(b != NULL);
     
    746747            if (output[strlen(output) - 1] == '\n')
    747748                output[strlen(output) - 1] = '\0';
    748             paranoid_free(blurb);
    749             paranoid_free(original_contents);
     749            mr_free(blurb);
     750            mr_free(original_contents);
    750751            return (TRUE);
    751752        }
     
    778779        if (b_res == b_2) {
    779780            strcpy(output, original_contents);
    780             paranoid_free(blurb);
    781             paranoid_free(original_contents);
     781            mr_free(blurb);
     782            mr_free(original_contents);
    782783            return (FALSE);
    783784        } else {
    784             paranoid_free(blurb);
    785             paranoid_free(original_contents);
     785            mr_free(blurb);
     786            mr_free(original_contents);
    786787            return (TRUE);
    787788        }
     
    808809        newtComponent text;
    809810
    810         prompt = malloc(MAX_NEWT_COMMENT_LEN);
    811         tmp = malloc(MAX_NEWT_COMMENT_LEN);
     811        prompt = mr_malloc(MAX_NEWT_COMMENT_LEN);
     812        tmp = mr_malloc(MAX_NEWT_COMMENT_LEN);
    812813        assert_string_is_neither_NULL_nor_zerolength(p);
    813814        assert(button1 != NULL);
     
    826827            }
    827828            if (!strcmp(tmp, button1)) {
    828                 paranoid_free(tmp);
    829                 paranoid_free(prompt);
     829                mr_free(tmp);
     830                mr_free(prompt);
    830831                return (TRUE);
    831832            } else {
    832                 paranoid_free(tmp);
    833                 paranoid_free(prompt);
     833                mr_free(tmp);
     834                mr_free(prompt);
    834835                return (FALSE);
    835836            }
     
    862863        newtPopWindow();
    863864        if (b_res == b_1) {
    864             paranoid_free(tmp);
    865             paranoid_free(prompt);
     865            mr_free(tmp);
     866            mr_free(prompt);
    866867            return (TRUE);
    867868        } else {
    868             paranoid_free(tmp);
    869             paranoid_free(prompt);
     869            mr_free(tmp);
     870            mr_free(prompt);
    870871            return (FALSE);
    871872        }
     
    927928
    928929        err_log_lines =
    929             (char **) malloc(sizeof(char *) * g_noof_log_lines);
     930            (char **) mr_malloc(sizeof(char *) * g_noof_log_lines);
    930931        if (!err_log_lines) {
    931932            fatal_error("Out of memory");
     
    933934
    934935        for (i = 0; i < g_noof_log_lines; i++) {
    935             err_log_lines[i] = (char *) malloc(MAX_NEWT_COMMENT_LEN);
     936            err_log_lines[i] = (char *) mr_malloc(MAX_NEWT_COMMENT_LEN);
    936937            if (!err_log_lines[i]) {
    937938                fatal_error("Out of memory");
     
    10431044            newtRefresh();
    10441045        }
    1045         paranoid_free(timeline_str);
    1046         paranoid_free(pcline_str);
    1047         paranoid_free(taskprogress);
     1046        mr_free(timeline_str);
     1047        mr_free(pcline_str);
     1048        mr_free(taskprogress);
    10481049    }
    10491050
     
    11041105
    11051106//  log_msg(1, "'%s' '%s' '%s'", blurb1, blurb2, blurb3);
    1106         percentline_str = malloc(MAX_NEWT_COMMENT_LEN);
    1107         timeline_str = malloc(MAX_NEWT_COMMENT_LEN);
    1108         taskprogress = malloc(MAX_NEWT_COMMENT_LEN);
     1107        percentline_str = mr_malloc(MAX_NEWT_COMMENT_LEN);
     1108        timeline_str = mr_malloc(MAX_NEWT_COMMENT_LEN);
     1109        taskprogress = mr_malloc(MAX_NEWT_COMMENT_LEN);
    11091110        malloc_string(tmp);
    11101111        if (!g_text_mode) {
     
    11901191            newtRefresh();
    11911192        }
    1192         paranoid_free(percentline_str);
    1193         paranoid_free(timeline_str);
    1194         paranoid_free(taskprogress);
    1195         paranoid_free(tmp);
     1193        mr_free(percentline_str);
     1194        mr_free(timeline_str);
     1195        mr_free(taskprogress);
     1196        mr_free(tmp);
    11961197    }
    11971198
     
    12461247        newtComponent myForm;
    12471248
    1248         title_sz = malloc(MAX_NEWT_COMMENT_LEN);
    1249         minimsg_sz = malloc(MAX_NEWT_COMMENT_LEN);
    1250         outstr = malloc(MAX_NEWT_COMMENT_LEN);
     1249        title_sz = mr_malloc(MAX_NEWT_COMMENT_LEN);
     1250        minimsg_sz = mr_malloc(MAX_NEWT_COMMENT_LEN);
     1251        outstr = mr_malloc(MAX_NEWT_COMMENT_LEN);
    12511252        if (g_text_mode) {
    12521253            for (backup_type = none; backup_type == none;) {
     
    12651266                }
    12661267            }
    1267             paranoid_free(title_sz);
    1268             paranoid_free(minimsg_sz);
    1269             paranoid_free(outstr);
     1268            mr_free(title_sz);
     1269            mr_free(minimsg_sz);
     1270            mr_free(outstr);
    12701271            return (backup_type);
    12711272        }
     
    13151316        }
    13161317        newtPopHelpLine();
    1317         paranoid_free(title_sz);
    1318         paranoid_free(minimsg_sz);
    1319         paranoid_free(outstr);
     1318        mr_free(title_sz);
     1319        mr_free(minimsg_sz);
     1320        mr_free(outstr);
    13201321        return (output);
    13211322    }
     
    14031404            log_msg(2, "Can't open %s; therefore, cannot popup list",
    14041405                    source_file);
    1405             paranoid_free(tmp);
     1406            mr_free(tmp);
    14061407            return (1);
    14071408        }
     
    14371438        if (filelist->entries >= ARBITRARY_MAXIMUM) {
    14381439            log_to_screen("Arbitrary limits suck, man!");
    1439             paranoid_free(tmp);
     1440            mr_free(tmp);
    14401441            return (1);
    14411442        }
     
    14651466            }
    14661467        }
    1467         paranoid_free(tmp);
     1468        mr_free(tmp);
    14681469        iamhere("leaving");
    14691470        return (0);
     
    14981499        tmp[98] = '\0';
    14991500        strcpy(comment, tmp);
    1500         paranoid_free(tmp);
     1501        mr_free(tmp);
    15011502        iamhere("leaving");
    15021503        return (comment);
     
    15391540        struct s_filelist *filelist;
    15401541        malloc_string(reason);
    1541         tmp = malloc(5000);
     1542        tmp = mr_malloc(5000);
    15421543        malloc_string(differ_sz);
    15431544        assert_string_is_neither_NULL_nor_zerolength(source_file);
     
    15511552        if (lng < 1) {
    15521553            log_msg(2, "No lines in file. Therefore, no popup list.");
    1553             paranoid_free(reason);
     1554            mr_free(reason);
    15541555            goto free_to_go;
    15551556        } else if (lng >= ARBITRARY_MAXIMUM) {
     
    15581559        }
    15591560
    1560         filelist = (struct s_filelist *) malloc(sizeof(struct s_filelist));
     1561        filelist = (struct s_filelist *) mr_malloc(sizeof(struct s_filelist));
    15611562        fileListbox =
    15621563            newtListbox(2, 2, 12, NEWT_FLAG_SCROLL | NEWT_FLAG_RETURNEXIT);
     
    15661567            log_msg(2, "Can't open %s; therefore, cannot popup list",
    15671568                    source_file);
    1568             paranoid_free(reason);
     1569            mr_free(reason);
    15691570            return;
    15701571        }
     
    16181619        newtPopHelpLine();
    16191620      free_to_go:
    1620         paranoid_free(reason);
    1621         paranoid_free(tmp);
    1622         paranoid_free(differ_sz);
     1621        mr_free(reason);
     1622        mr_free(tmp);
     1623        mr_free(differ_sz);
    16231624        return;
    16241625    }
  • branches/stable/mondo/src/include/my-stuff.h

    r1078 r1080  
    1414#define NOOF_ERR_LINES  6   
    1515
    16 #define paranoid_free(exp) mr_free(exp)
    17 
    1816/**
    1917 * @file
     
    2220
    2321#include <stdio.h>
     22#include "mr_mem.h"
    2423
    2524#if !defined(bool) && !defined(__cplusplus)
     
    286285 * Malloc @p x to be MAX_STR_LEN bytes and call fatal_error() if we're out of memory.
    287286 */
    288 #define malloc_string(x) { x = (char *)malloc(MAX_STR_LEN); if (!x) { fatal_error("Unable to malloc"); } x[0] = x[1] = '\0'; }
     287#define malloc_string(x) { x = (char *)mr_malloc(MAX_STR_LEN); x[0] = x[1] = '\0'; }
    289288
    290289/**
  • branches/stable/mondo/src/mondoarchive/main.c

    r1067 r1080  
    11/***************************************************************************
    2                           main.c  -  description
    3                              -------------------
    4     begin                : Fri Apr 19 16:40:35 EDT 2002
    5     copyright            : (C) 2002 by Stan Benoit
    6     email                : troff@nakedsoul.org
    7     cvsid                : $Id$
    8  ***************************************************************************/
    9 
    10 /***************************************************************************
    11  *                                                                         *
    12  *   This program is free software; you can redistribute it and/or modify  *
    13  *   it under the terms of the GNU General Public License as published by  *
    14  *   the Free Software Foundation; either version 2 of the License, or     *
    15  *   (at your option) any later version.                                   *
    16  *                                                                         *
    17  ***************************************************************************/
    18 
    19 /** change log ****** MONDO-DEVEL
    20 
    21 
    22 12/10
    23 - disable stopping/starting of autofs
    24 
    25 10/01
    26 - update g_erase_tmpdir_and_scratchdir to delete user-specified tmpdir, scratchdir
    27 
    28 06/19
    29 - added AUX_VER
    30 
    31 06/14/2004
    32 - use mondorescue.iso, not mindi.iso
    33 
    34 02/10/2004
    35 - tell users where BusyBox's sources are
    36 
    37 11/14/2003
    38 - cleaned up logging at end#
    39 
    40 10/23
    41 - don't try to test-read tape ... That's already
    42   handled by post_param_configuration()
    43  
    44 10/19
    45 - if your PATH var is too long, abort
    46 
    47 09/23
    48 - added some comments
    49 - malloc/free global strings in new subroutines - malloc_libmondo_global_strings()
    50   and free_libmondo_global_strings() - which are in libmondo-tools.c
    51 - better magicdev support
    52 
    53 
    54 09/16
    55 - delete /var/log/partimagehack-debug.log at start of main()
    56 
    57 09/15
    58 - added askbootloader
    59 
    60 09/09
    61 - if your tape is weird, I'll pause between backup and verify
    62 - fixed silly bug in main() - re: say_at_end
    63 
    64 01/01 - 08/31
    65 - call 'dmesg -n1' at start, to shut the kernel logger up
    66 - moved g_erase_tmpdir_and_scratchdir to common/newt-specific.c
    67 - added 'don't panic' msg to start of logfile
    68 - added 'nice(20)' to main()
    69 - added lots of assert()'s and log_OS_error()'s
    70 - clean-up (Hugo)
    71 - make post_param_configuration() setup g_erase_tmpdir_and_scratchdir
    72 - if --version then print & exit quickly
    73 - re-run g_erase_tmpdir_and_scratchdir via system() at very end
    74 
    75 Year: 2002
    76 - if user goes root with 'su' instead of 'su -' then
    77   workaround it by setting PATH correctly
    78 - wipe mondoarchive.log at very beginning
    79 - cleaned up code
    80 - if changed.files.N exists then copy to changes.files for display
    81 - run_program_and_log_output() now takes boolean operator to specify
    82   whether it will log its activities in the event of _success_
    83 - added popup list of changed files
    84 - removed 'beta-quality' warnings
    85 - if kernel not found and mondo in graphics mode then popup and ask
    86   for kernel path+filename
    87 - fixed tmp[] 'too small' bug
    88 - unmount and eject CD at end of verify cycle
    89 - moved interactively_obtain...() to libmondo-stream.c
    90 - wrote stuff to autodetect tape+cdrw+etc.
    91 - renamed from main.c to mondo-archive.c
    92 - fore+after warnings that this code is beta-quality
    93 - abort if running from ramdisk
    94 - remount floppy at end & unmount at start if Mandrake
    95 - took out #debug stuff
    96 - add 2> /dev/null to 'find' command
    97 - add support for bkpinfo->nonbootable_backup
    98 - add main function begin comment and debug conditional
    99   compilation - Stan Benoit
    100 - add debug statements to build a run tree. Stan Benoit
    101 **** end change log **********/
     2* $Id$
     3*/
    1024
    1035
     
    286188    say_at_end[0] = '\0';
    287189    printf("Initializing...\n");
    288     if (!(bkpinfo = malloc(sizeof(struct s_bkpinfo)))) {
    289         fatal_error("Cannot malloc bkpinfo");
    290     }
     190    bkpinfo = mr_malloc(sizeof(struct s_bkpinfo));
    291191
    292192    /* initialize log file with time stamp */
     
    538438    system(g_erase_tmpdir_and_scratchdir);
    539439    free_libmondo_global_strings();
    540     paranoid_free(say_at_end);
    541     paranoid_free(tmp);
    542     paranoid_free(bkpinfo);
     440    mr_free(say_at_end);
     441    mr_free(tmp);
     442    mr_free(bkpinfo);
    543443
    544444    unlink("/tmp/filelist.full");
  • branches/stable/mondo/src/mondoarchive/mondo-cli.c

    r1067 r1080  
    11/***************************************************************************
    2 mondo-cli.c
    3 -------------------
    4 begin                : Fri Apr 19 16:40:35 EDT 2002
    5 copyright        : (C) 2002 Mondo  Hugo Rabson
    6 email                : Hugo Rabson <hugorabson@msn.com>
    7 edited by            : by Stan Benoit 4/2002
    8 email                : troff@nakedsoul.org
    9 cvsid                : $Id$
    10  ***************************************************************************/
    11 
    12 /***************************************************************************
    13  *                                                                         *
    14  *   This program is free software; you can redistribute it and/or modify  *
    15  *   it under the terms of the GNU General Public License as published by  *
    16  *   the Free Software Foundation; either version 2 of the License, or     *
    17  *   (at your option) any later version.                                   *
    18  *                                                                         *
    19  ***************************************************************************/
    20 
    21 /***************************************************************************
    22 UPDATE LOG
    23 
    24 
    25 08/04
    26 - if user specifies a dumb -T value, abort
    27 
    28 07/22
    29 - handle -Q sensibly (don't abort if only -Q supplied)
    30 
    31 07/17
    32 - better checking of NFS dir's validity
    33 
    34 06/19
    35 - added AUX_VER
    36 
    37 04/17
    38 - added '-b' support
    39 04/03
    40 - added star support
    41 
    42 02/06
    43 - fixed "Please give /dev entry" error msg
    44 
    45 01/20/2004
    46 - added 2.6.x-kernel "device = /dev/...." support to param reader
    47 - better handling of SCSI and /dev entries
    48 - touch /boot/boot.b if necessary
    49 
    50 09/26/2003
    51 - typo in command-line handling of 'r'
    52 
    53 09/25
    54 - added DVD write support
    55 
    56 09/24
    57 - if tape backup (-t) but user doesn't specify tape drive then
    58   make an educated guess using find_tape_device_and_size()
    59 
    60 09/18
    61 - insist on partimagehack being present if -x found
    62 
    63 09/16
    64 - added support for multiple -I's and -E's in call to mondoarchive
    65 - the '-D' flag doesn't take a value now
    66 
    67 07/14
    68 - fatal error if -E too short
    69 
    70 05/14
    71 - if 'n' and user doesn't have rights to write to output dir
    72   then error out
    73 
    74 05/05
    75 - added Joshua Oreman's FreeBSD patches
    76 
    77 05/04
    78 - added Herman Kuster's multi-level bkp patch
    79 
    80 05/02
    81 - write errors to screen, not just to log
    82 
    83 04/25
    84 - added lots of assert()'s and log_OS_error()'s
    85 
    86 04/21
    87 - line 570 --- resolve boot device if softlink
    88 
    89 04/08
    90 - changed a bunch of fprintf(stderr,...)'s to log_it()'s
    91 - fixed final / removal in retrieve_switches_from_command_line()
    92 
    93 04/04
    94 - added -e
    95 
    96 03/15
    97 - reject relative paths if -d flag (Alessandro Polverini)
    98 
    99 01/02/2003
    100 - added -J flag (to let user specify incoming filelist)
    101 
    102 12/13/2002
    103 - various strcpy() calls replaced with strncpy() calls
    104 
    105 12/10
    106 - added g_loglevel
    107 
    108 11/25
    109 - line 614 --- if commmand-line param ends in '/' then drop that '/'
    110 
    111 11/19
    112 - rewrote finish() to kill processes more softly
    113 - if user calls with '-l RAW' then
    114 
    115 09/01 - 09/30
    116 - added -N to let user exclude all NFS-related mounts and devices
    117 - run_program_and_log_output() now takes boolean operator to specify
    118   whether it will log its activities in the event of _success_
    119 
    120 08/01 - 08/31
    121 - if no device specified when backing up to tape streamer then assume /dev/st0
    122 - abort if tape user specifies tape size (just for testing porpoises)
    123 - tape users no longer need to specify tape size
    124 - added some comments
    125 - added bkpinfo->backup_media_type
    126 - renamed from mondo-archive.c to mondo-cli.c
    127 
    128 07/01 - 07/31
    129 - better check for mkfs.vfat
    130 - more sanity-checking for -d flag
    131 - if isodir does not exist then abort
    132 - removed "the rest are..." comment from log
    133 - do not permit '-H' and '-t' in the same command line
    134 - if not '-o' then insist on vfat-friendly kernel
    135 
    136 06/01 - 06/30
    137 - added signal-trapping
    138 - added '-W' (won't make bootable CD or floppies) flag
    139 - added missing 'j++' to -s switch's code
    140 - expanded -s switch
    141 - added -u switch
    142 - if dvdrecord exists and cdrecord doesn't then use
    143   dvdrecord instead of cdrecord
    144 
    145 04/01 - 04/30
    146 - if CD-ROM is supermounted then unmount, run, and remount
    147 - replace MONDO_VERSION #define with VERSION from ../config.h
    148 - if CD-ROM is mounted at start then abort
    149 - improved homedir-locating code
    150 - improved "backup will occupy N CD's" calculation a bit
    151 - added -m (manual CD tray) flag
    152 
    153 
     2$Id$
    1543*******************************************************************/
    1554
     
    16615#include "mondo-cli-EXT.h"
    16716#include "../common/libmondo.h"
     17#include "mr_mem.h"
    16818
    16919//static char cvsid[] = "$Id$";
     
    282132        store_nfs_config(bkpinfo);
    283133    }
    284     paranoid_free(tmp);
     134    mr_free(tmp);
    285135    return (retval);
    286136}
     
    440290            strcat(bkpinfo->include_paths, " ");
    441291        }
    442         asprintf(&tmp1, flag_val['I']);
     292        mr_asprintf(&tmp1, flag_val['I']);
    443293        p = tmp1;
    444294        q = tmp1;
     
    462312            }
    463313        }
    464         paranoid_free(tmp1);
     314        mr_free(tmp1);
    465315
    466316        strncpy(bkpinfo->include_paths + strlen(bkpinfo->include_paths),
     
    684534    if (flag_set['z']) {
    685535        if (find_home_of_exe("getfattr")) {
    686             asprintf(&g_getfattr,"getfattr");
     536            mr_asprintf(&g_getfattr,"getfattr");
    687537        }
    688538        if (find_home_of_exe("getfacl")) {
    689             asprintf(&g_getfacl,"getfacl");
     539            mr_asprintf(&g_getfacl,"getfacl");
    690540        }
    691541    }
     
    700550            strcat(bkpinfo->exclude_paths, " ");
    701551        }
    702         asprintf(&tmp1, flag_val['E']);
     552        mr_asprintf(&tmp1, flag_val['E']);
    703553        p = tmp1;
    704554        q = tmp1;
     
    728578            }
    729579        }
    730         paranoid_free(tmp1);
     580        mr_free(tmp1);
    731581
    732582        strncpy(bkpinfo->exclude_paths + strlen(bkpinfo->exclude_paths),
     
    1005855/* and finally... */
    1006856
    1007     paranoid_free(tmp);
    1008     paranoid_free(psz);
     857    mr_free(tmp);
     858    mr_free(psz);
    1009859    return (retval);
    1010860}
  • branches/stable/mondo/src/mondorestore/mondo-prep.c

    r1067 r1080  
    11/***************************************************************************
    2 mondo-prep.c  -  description
    3 -----------------
    4 
    5 begin: Fri Apr 19 16:40:35 EDT 2002
    6 copyright : (C) 2002 Mondo  Hugo Rabson
    7 email     : Hugo Rabson <hugorabson@msn.com>
    8 edited by : by Stan Benoit 4/2002
    9 email     : troff@nakedsoul.org
    10 cvsid     : $Id$
    11 ***************************************************************************/
    12 
    13 /***************************************************************************
    14  *                                                                         *
    15  *   This program is free software; you can redistribute it and/or modify  *
    16  *   it under the terms of the GNU General Public License as published by  *
    17  *   the Free Software Foundation; either version 2 of the License, or     *
    18  *   (at your option) any later version.                                   *
    19  *                                                                         *
    20  ***************************************************************************/
    21 
    22 /* mondo-prep.c             Hugo Rabson
    23 
    24 
    25 
    26 07/20
    27 - when starting RAID, don't do it twice :)
    28 - moved Joshua's new get_phys_size_of_drive() code
    29   from resize_drive... into get_phys_size_of_drive()
    30 
    31 06/29
    32 - make sure software RAID devices are formatted IF user says they're to be
    33 - drivelist is struct now, not char[][]
    34 
    35 06/26
    36 - drop make_relevant_partition_bootable(); do it yourself in C (mostly)
    37 - offer to reboot if partition table is locked up by the kernel
    38 
    39 06/22
    40 - be sure not to resize non-NTFS images when restoring
    41 - set non-NTFS images' partition types properly
    42 
    43 06/19
    44 - shut down all LVMs and VGs before prepping
    45 
    46 05/07
    47 - usage of parted2fdisk instead of fdisk alone (ia32/ia64 compatibility)
    48   BCO
    49 
    50 03/31
    51 - rewrote partitioning and formatting code to call fdisk once per disk
    52 
    53 10/21/2003
    54 - suspend/resume Newt gui before/after calling do_my_funky_lvm_stuff()
    55 
    56 10/20
    57 - rewrote format_everything() - what a mess it was.
    58   It now does things in three phases:-
    59   - formats software RAID devices (/dev/md0, etc.)
    60   - formats and configures LVM devices
    61   - formats regular partitions (/dev/hda1, /dev/sdb2, etc.)
    62     and any LVMs recently prepped
    63 
    64 10/07
    65 - use strstr(format, "raid") instead of strcmp(format,"raid") to determin
    66   if partition is a RAID component
    67 
    68 09/23
    69 - better comments
    70 
    71 09/18
    72 - better logging of RAID activity
    73 
    74 05/05
    75 - added Joshua Oreman's FreeBSD patches
    76 
    77 04/30
    78 - added textonly mode
    79 
    80 04/24
    81 - added lots of assert()'s and log_OS_error()'s
    82 
    83 04/21
    84 - format_everything() --- don't let bar go too far
    85 - mkfs -c to check for bad blocks when formatting
    86 
    87 04/04
    88 - misc clean-up (Tom Mortell)
    89 
    90 01/15/2003
    91 - added code for LVM and SW Raid (Brian Borgeson)
    92 
    93 12/10/2002
    94 - line 1238: friendlier output
    95 
    96 11/20
    97 - when wiping a given device in preparation for partitioning + formatting
    98   it, don't wipe the MBR; just the partition table. That allows for
    99   stupid-ass Compaq users who like to play with their MBR's.
    100 - disable mountlist.txt-->mountlist.txt.pre-resize copying (superfluous)
    101 
    102 09/09
    103 - run_program_and_log_output() now takes boolean operator to specify
    104   whether it will log its activities in the event of _success_
    105 
    106 07/01 - 07/31
    107 - added hooks to libmondo
    108 - RAID enhancements (Philippe de Muyter)
    109 
    110 01/01 - 03/31
    111 - partition_device() will refuse to partition /dev/mdX now (cos it's a
    112   virtual drive); however, it will return 0 (i.e. not an error)
    113 - make_list_of_drives() will exclude /dev/md* from list
    114 - mkreiserfs -ff instead of -q (Andy Glass)
    115 - don't resize drive if drive not found (or if its size cannot be det'd)
    116 - when generating list of drives from mountlist, skip the 'p' at the end
    117   of drive name if /dev/ida/ or /dev/cciss/; just do it (Michael Eisenberg)
    118 - don't specify journal size when formatting ext3
    119   (used to have -Jsize=10 in the call to mkfs)
    120 - handles files >2GB in size
    121 - format interactively, if Interactive Mode
    122 - removed reference to g_tape_size
    123 - when executing /tmp/i-want-my-lvm, only record the error# if the command
    124   was _not_ an 'insmod' command
    125 - pass partition size to fdisk in Kilobytes now, not Megabytes
    126 - log fdisk's output to /tmp/mondo-restore.log if it fails
    127 - don't try to format partitions of type 'image'
    128 - don't type to set types of 'image' partitions
    129 - if format code is 1 or 2 chars then assume it is a hex string
    130 - took out all '/ /' comments
    131 - don't extrapolate/add partition from RAID dev to mountlist if it's already
    132   present in mountlist
    133 - less repetitive logging in the event of vacuum-packing of last part'n
    134 - no extrapolation at all: RAID partitions should be listed in mountlist
    135   already, thanks to either Mindi v0.5x or the mountlist editor itself
    136 - no longer say, 'and logging to...' when setting a partition's type
    137 - don't run mkfs on RAID partitions (/dev/hd*, /dev/sd*); just set type
    138 - the setting of a partition's type now takes place in a separate subroutine
    139   from the subroutine that actually creates the partition
    140 - no need to set type if 83: 83 is the default (under fdisk)
    141 - turned on '-Wall'; cleaned up some cruft
    142 - if vacuum-packing partition (i.e. size=0MB --> max) then say, "(maximum)"
    143   not, "(0 MB)"
    144 
    145 11/22/2001
    146 - preliminary code review
    147 - created on Nov 22nd, 2001
     2 * $Id$
    1483*/
    1494
     
    16217#include <linux/hdreg.h>
    16318#include <math.h>
     19#include "mr_mem.h"
    16420
    16521
     
    22076    malloc_string(command);
    22177    malloc_string(tmp);
    222     buf = malloc(blocksize);
     78    buf = mr_malloc(blocksize);
    22379    if (does_file_exist("/tmp/i-want-my-lvm"))  // FIXME - cheating :)
    22480    {
    225         drivelist = malloc(sizeof(struct list_of_disks));
     81        drivelist = mr_malloc(sizeof(struct list_of_disks));
    22682        make_list_of_drives_in_mountlist(mountlist, drivelist);
    22783        for (lino = 0; lino < drivelist->entries; lino++) {
     
    274130    }
    275131// Still here? Cool!
    276     paranoid_free(command);
    277     paranoid_free(tmp);
     132    mr_free(command);
     133    mr_free(tmp);
    278134    log_msg(1, "Cool. I didn't have to wipe anything.");
    279135}
     
    384240    malloc_string(vgremove_sz);
    385241//  malloc_string(do_this_last); // postpone lvcreate call if necessary
    386     command = malloc(512);
     242    command = mr_malloc(512);
    387243
    388244//  do_this_last[0] = '\0';
     
    549405    log_msg(1, "Closed i-want-my-lvm. Finished doing funky stuff.");
    550406  end_of_i_want_my_lvm:
    551     paranoid_free(tmp);
    552     paranoid_free(incoming);
    553     paranoid_free(command);
    554     paranoid_free(lvscan_sz);
    555     paranoid_free(lvremove_sz);
    556     paranoid_free(vgscan_sz);
    557     paranoid_free(pvscan_sz);
    558     paranoid_free(vgcreate_sz);
    559     paranoid_free(vgchange_sz);
    560     paranoid_free(vgremove_sz);
    561 //  paranoid_free(do_this_last);
     407    mr_free(tmp);
     408    mr_free(incoming);
     409    mr_free(command);
     410    mr_free(lvscan_sz);
     411    mr_free(lvremove_sz);
     412    mr_free(vgscan_sz);
     413    mr_free(pvscan_sz);
     414    mr_free(vgcreate_sz);
     415    mr_free(vgchange_sz);
     416    mr_free(vgremove_sz);
     417//  mr_free(do_this_last);
    562418    system("sync");
    563419    system("sync");
     
    686542        }
    687543    }
    688     paranoid_free(incoming);
    689     paranoid_free(tmp);
     544    mr_free(incoming);
     545    mr_free(tmp);
    690546
    691547    return (0);
     
    734590  for (j = 1; j < raidlist->el[i].data_disks.entries; j++) {
    735591    asprintf(&strtmp, "%s", devices);
    736     paranoid_free(devices);
     592    mr_free(devices);
    737593    asprintf(&devices, "%s %s", strtmp,
    738594         raidlist->el[i].data_disks.el[j].device);
    739     paranoid_free(strtmp);
     595    mr_free(strtmp);
    740596  }
    741597  for (j = 0; j < raidlist->el[i].spare_disks.entries; j++) {
    742598    asprintf(&strtmp, "%s", devices);
    743     paranoid_free(devices);
     599    mr_free(devices);
    744600    asprintf(&devices, "%s %s", strtmp,
    745601         raidlist->el[i].spare_disks.el[j].device);
    746     paranoid_free(strtmp);
     602    mr_free(strtmp);
    747603  }
    748604  // translate RAID level
     
    765621  if (raidlist->el[i].parity != -1) {
    766622    asprintf(&strtmp, "%s", program);
    767     paranoid_free(program);
     623    mr_free(program);
    768624    switch(raidlist->el[i].parity) {
    769625    case 0:
     
    783639      break;
    784640    }
    785     paranoid_free(strtmp);
     641    mr_free(strtmp);
    786642  }
    787643  if (raidlist->el[i].chunk_size != -1) {
    788644    asprintf(&strtmp, "%s", program);
    789     paranoid_free(program);
     645    mr_free(program);
    790646    asprintf(&program, "%s --chunk=%d", strtmp, raidlist->el[i].chunk_size);
    791     paranoid_free(strtmp);
     647    mr_free(strtmp);
    792648  }
    793649  if (raidlist->el[i].spare_disks.entries > 0) {
    794650    asprintf(&strtmp, "%s", program);
    795     paranoid_free(program);
     651    mr_free(program);
    796652    asprintf(&program, "%s --spare-devices=%d", strtmp,
    797653         raidlist->el[i].spare_disks.entries);
    798     paranoid_free(strtmp);
     654    mr_free(strtmp);
    799655  }
    800656  asprintf(&strtmp, "%s", program);
    801   paranoid_free(program);
     657  mr_free(program);
    802658  asprintf(&program, "%s %s", strtmp, devices);
    803   paranoid_free(strtmp);
     659  mr_free(strtmp);
    804660  res = run_program_and_log_output(program, 1);
    805661  // free memory
    806   paranoid_free(devices);
    807   paranoid_free(level);
    808   paranoid_free(program);
     662  mr_free(devices);
     663  mr_free(level);
     664  mr_free(program);
    809665  // return to calling instance
    810666  return res;
     
    845701        sprintf(tmp, "Not formatting %s (it is a RAID disk)", device);
    846702        log_it(tmp);
    847         paranoid_free(program);
    848         paranoid_free(tmp);
     703        mr_free(program);
     704        mr_free(tmp);
    849705        return (0);
    850706    }
     
    852708    if (strcmp(format, "swap") == 0) {
    853709        log_it("Not formatting %s - it's swap", device);
    854         paranoid_free(program);
    855         paranoid_free(tmp);
     710        mr_free(program);
     711        mr_free(tmp);
    856712        return (0);
    857713    }
     
    862718                device, format);
    863719        log_it(tmp);
    864         paranoid_free(program);
    865         paranoid_free(tmp);
     720        mr_free(program);
     721        mr_free(tmp);
    866722        return (0);
    867723    }
     
    869725        sprintf(tmp, "%s is mounted - cannot format it       ", device);
    870726        log_to_screen(tmp);
    871         paranoid_free(program);
    872         paranoid_free(tmp);
     727        mr_free(program);
     728        mr_free(tmp);
    873729        return (1);
    874730    }
     
    986842    if (!strcmp(format, "lvm")) {
    987843        log_msg(1, "Don't format %s - it's part of an lvm volume", device);
    988         paranoid_free(program);
    989         paranoid_free(tmp);
     844        mr_free(program);
     845        mr_free(tmp);
    990846        return (0);
    991847    }
     
    1026882
    1027883    log_to_screen(tmp);
    1028     paranoid_free(program);
    1029     paranoid_free(tmp);
     884    mr_free(program);
     885    mr_free(tmp);
    1030886    system("sync");
    1031887    sleep(1);
     
    12531109    system("clear");
    12541110    newtResume();
    1255     paranoid_free(tmp);
     1111    mr_free(tmp);
    12561112    return (retval);
    12571113}
     
    13081164        previous_devno = current_devno;
    13091165    }
    1310     paranoid_free(tmp);
     1166    mr_free(tmp);
    13111167    return (previous_devno);
    13121168}
     
    16491505    if (!pout_to_fdisk) {
    16501506        log_to_screen("Cannot call parted2fdisk to configure %s", drivename);
    1651         paranoid_free(device_str);
    1652         paranoid_free(format);
    1653         paranoid_free(tmp);
     1507        mr_free(device_str);
     1508        mr_free(format);
     1509        mr_free(tmp);
    16541510        return (1);
    16551511    }
     
    16861542                            ("Warning! Unable to make the drive bootable.");
    16871543                    }
    1688                     paranoid_free(device_str);
    1689                     paranoid_free(format);
    1690                     paranoid_free(tmp);
     1544                    mr_free(device_str);
     1545                    mr_free(format);
     1546                    mr_free(tmp);
    16911547                    return r;
    16921548                }
     
    17771633            log_to_screen
    17781634                ("You must leave at least one partition spare as the Extended partition.");
    1779             paranoid_free(device_str);
    1780             paranoid_free(format);
    1781             paranoid_free(tmp);
     1635            mr_free(device_str);
     1636            mr_free(format);
     1637            mr_free(tmp);
    17821638            return (1);
    17831639        }
     
    18251681        }
    18261682    }
    1827     paranoid_free(device_str);
    1828     paranoid_free(format);
    1829     paranoid_free(tmp);
     1683    mr_free(device_str);
     1684    mr_free(format);
     1685    mr_free(tmp);
    18301686    return (retval);
    18311687}
     
    18771733        sprintf(tmp, "Not partitioning %s - it is a virtual drive", drive);
    18781734        log_it(tmp);
    1879         paranoid_free(program);
    1880         paranoid_free(partition_name);
    1881         paranoid_free(tmp);
    1882         paranoid_free(logfile);
    1883         paranoid_free(output);
     1735        mr_free(program);
     1736        mr_free(partition_name);
     1737        mr_free(tmp);
     1738        mr_free(logfile);
     1739        mr_free(output);
    18841740        return (0);
    18851741    }
     
    18981754                partition_name);
    18991755        log_to_screen(tmp);
    1900         paranoid_free(program);
    1901         paranoid_free(partition_name);
    1902         paranoid_free(tmp);
    1903         paranoid_free(logfile);
    1904         paranoid_free(output);
     1756        mr_free(program);
     1757        mr_free(partition_name);
     1758        mr_free(tmp);
     1759        mr_free(logfile);
     1760        mr_free(output);
    19051761        return (1);
    19061762/*
     
    19331789                    log_to_screen
    19341790                        ("You need to leave at least one partition free, for 'extended/logical'");
    1935                     paranoid_free(program);
    1936                     paranoid_free(partition_name);
    1937                     paranoid_free(tmp);
    1938                     paranoid_free(logfile);
    1939                     paranoid_free(output);
     1791                    mr_free(program);
     1792                    mr_free(partition_name);
     1793                    mr_free(tmp);
     1794                    mr_free(logfile);
     1795                    mr_free(output);
    19401796                    return (1);
    19411797                } else {
     
    20561912    g_current_progress++;
    20571913    log_it("partition_device() --- leaving");
    2058     paranoid_free(program);
    2059     paranoid_free(partition_name);
    2060     paranoid_free(tmp);
    2061     paranoid_free(logfile);
    2062     paranoid_free(output);
     1914    mr_free(program);
     1915    mr_free(partition_name);
     1916    mr_free(tmp);
     1917    mr_free(logfile);
     1918    mr_free(output);
    20631919    return (retval);
    20641920}
     
    20871943    /** end ************************************************************/
    20881944
    2089     drivelist = malloc(sizeof(struct list_of_disks));
     1945    drivelist = mr_malloc(sizeof(struct list_of_disks));
    20901946    assert(mountlist != NULL);
    20911947
     
    21462002    system("clear");
    21472003    newtResume();
    2148     paranoid_free(drivelist);
     2004    mr_free(drivelist);
    21492005    return (retval);
    21502006}
     
    22902146    }
    22912147
    2292     paranoid_free(partition);
    2293     paranoid_free(command);
    2294     paranoid_free(output);
    2295     paranoid_free(tmp);
    2296     paranoid_free(partcode);
    2297     paranoid_free(logfile);
     2148    mr_free(partition);
     2149    mr_free(command);
     2150    mr_free(output);
     2151    mr_free(tmp);
     2152    mr_free(partcode);
     2153    mr_free(logfile);
    22982154
    22992155    return (res);
     
    24482304             "r");
    24492305        if (!fin) {
    2450             paranoid_free(dev);
    2451             paranoid_free(incoming);
     2306            mr_free(dev);
     2307            mr_free(incoming);
    24522308            return (1);
    24532309        }
     
    24602316        if (!fin) {
    24612317            log_OS_error("/proc/mdstat");
    2462             paranoid_free(dev);
    2463             paranoid_free(incoming);
     2318            mr_free(dev);
     2319            mr_free(incoming);
    24642320            return (1);
    24652321        }
     
    24822338        log_msg(1, "Warning - unable to stop some RAID devices");
    24832339    }
    2484     paranoid_free(dev);
    2485     paranoid_free(incoming);
     2340    mr_free(dev);
     2341    mr_free(incoming);
    24862342    system("sync");
    24872343    system("sync");
     
    25462402        res = 0;
    25472403    }
    2548     paranoid_free(tmp);
     2404    mr_free(tmp);
    25492405    return (res);
    25502406}
     
    25882444    }
    25892445    original_size_of_drive = original_size_of_drive / 1024;
    2590     paranoid_free(tmp);
     2446    mr_free(tmp);
    25912447    return (original_size_of_drive);
    25922448}
     
    26382494        if (strncmp(drive_name, RAID_DEVICE_STUB, strlen(RAID_DEVICE_STUB))
    26392495            == 0) {
    2640             paranoid_free(tmp);
     2496            mr_free(tmp);
    26412497            return;
    26422498        }
     
    26522508    if (current_size_of_drive <= 0) {
    26532509        log_it("Not resizing to match %s - can't find drive", drive_name);
    2654         paranoid_free(tmp);
     2510        mr_free(tmp);
    26552511        return;
    26562512    }
     
    26592515    log_to_screen(tmp);
    26602516
    2661     drivemntlist = malloc(sizeof(struct mountlist_reference));
     2517    drivemntlist = mr_malloc(sizeof(struct mountlist_reference));
    26622518    drivemntlist->el =
    2663         malloc(sizeof(struct mountlist_line *) * MAX_TAPECATALOG_ENTRIES);
    2664 
    2665     if (!drivemntlist) {
    2666         fatal_error("Cannot malloc temporary mountlist\n");
    2667     }
     2519        mr_malloc(sizeof(struct mountlist_line *) * MAX_TAPECATALOG_ENTRIES);
     2520
    26682521    create_mountlist_for_drive(mountlist, drive_name, drivemntlist);
    26692522
     
    26772530                drive_name);
    26782531        log_to_screen(tmp);
    2679         paranoid_free(tmp);
     2532        mr_free(tmp);
    26802533        return;
    26812534    }
     
    27122565    final_size = get_phys_size_of_drive(drive_name);
    27132566    sprintf(tmp, "final_size = %ld MB", final_size);
    2714     paranoid_free(tmp);
     2567    mr_free(tmp);
    27152568    log_to_screen(tmp);
    27162569}
     
    27342587    /** end *************************************************************/
    27352588
    2736     drivelist = malloc(sizeof(struct list_of_disks));
    2737     assert(mountlist != NULL);
     2589    drivelist = mr_malloc(sizeof(struct list_of_disks));
    27382590
    27392591    if (g_mountlist_fname[0] == '\0') {
     
    27532605    }
    27542606    log_to_screen("Mountlist adjusted to suit current hard drive(s)");
    2755     paranoid_free(drivelist);
     2607    mr_free(drivelist);
    27562608}
    27572609
     
    27982650    }
    27992651    if (tmp_drive_name)
    2800         free(tmp_drive_name);
     2652        mr_free(tmp_drive_name);
    28012653}
    28022654
  • branches/stable/mondo/src/mondorestore/mondo-restore.c

    r1077 r1080  
    11/***************************************************************************
    2 $Id$
    3 restores mondoarchive data
     2* restores mondoarchive data
     3* $Id$
    44***************************************************************************/
    55
     
    2020#include "mondo-rstr-compare-EXT.h"
    2121#include "mondo-rstr-tools-EXT.h"
     22#include "mr_mem.h"
    2223
    2324extern void twenty_seconds_til_yikes(void);
     
    313314        retval += compare_mode(bkpinfo, mountlist, raidlist);
    314315    }
    315     paranoid_free(tmp);
     316    mr_free(tmp);
    316317    return (retval);
    317318}
     
    631632    }
    632633  end_of_func:
    633     paranoid_free(tmp);
    634     paranoid_free(fstab_fname);
    635     paranoid_free(old_restpath);
     634    mr_free(tmp);
     635    mr_free(fstab_fname);
     636    mr_free(old_restpath);
    636637    iamhere("Leaving interactive_mode()");
    637638    return (retval);
     
    912913    assert(bkpinfo != NULL);
    913914    malloc_string(old_restpath);
    914     mountlist = malloc(sizeof(struct mountlist_itself));
    915     raidlist = malloc(sizeof(struct raidlist_itself));
    916     if (!mountlist || !raidlist) {
    917         fatal_error("Cannot malloc() mountlist and/or raidlist");
    918     }
     915    mountlist = mr_malloc(sizeof(struct mountlist_itself));
     916    raidlist = mr_malloc(sizeof(struct raidlist_itself));
    919917
    920918    strcpy(bkpinfo->restore_path, "/");
     
    966964        eject_device(bkpinfo->media_device);
    967965    }
    968     paranoid_free(old_restpath);
    969     free(mountlist);
    970     free(raidlist);
     966    mr_free(old_restpath);
     967    mr_free(mountlist);
     968    mr_free(raidlist);
    971969    return (retval);
    972970}
     
    10381036
    10391037    pathname_of_last_file_restored[0] = '\0';
    1040     if (!(bigblk = malloc(TAPE_BLOCK_SIZE))) {
    1041         fatal_error("Cannot malloc bigblk");
    1042     }
     1038    bigblk = mr_malloc(TAPE_BLOCK_SIZE);
    10431039
    10441040    if (!(fin = fopen(slice_fname(bigfileno, 0, ARCHIVES_PATH, ""), "r"))) {
     
    12951291        utime(outfile_fname, ubuf);
    12961292    }
    1297     paranoid_free(bigblk);
    1298     paranoid_free(checksum);
    1299     paranoid_free(outfile_fname);
    1300     paranoid_free(tmp);
    1301     paranoid_free(bzip2_command);
    1302     paranoid_free(ntfsprog_command);
    1303     paranoid_free(suffix);
    1304     paranoid_free(sz_devfile);
     1293    mr_free(bigblk);
     1294    mr_free(checksum);
     1295    mr_free(outfile_fname);
     1296    mr_free(tmp);
     1297    mr_free(bzip2_command);
     1298    mr_free(ntfsprog_command);
     1299    mr_free(suffix);
     1300    mr_free(sz_devfile);
    13051301
    13061302    return (retval);
     
    15531549    }
    15541550
    1555     paranoid_free(tmp);
    1556     paranoid_free(outfile_fname);
    1557     paranoid_free(command);
    1558     paranoid_free(ntfsprog_command);
    1559     paranoid_free(sz_devfile);
    1560     paranoid_free(ntfsprog_fifo);
     1551    mr_free(tmp);
     1552    mr_free(outfile_fname);
     1553    mr_free(command);
     1554    mr_free(ntfsprog_command);
     1555    mr_free(sz_devfile);
     1556    mr_free(ntfsprog_fifo);
    15611557    g_loglevel = old_loglevel;
    15621558    return (retval);
     
    17861782
    17871783  leave_sub:
    1788     paranoid_free(command);
    1789     paranoid_free(tmp);
    1790     paranoid_free(filelist_name);
    1791     paranoid_free(filelist_subset_fname);
    1792     paranoid_free(executable);
    1793     paranoid_free(temp_log);
    1794     paranoid_free(xattr_fname);
    1795     paranoid_free(acl_fname);
     1784    mr_free(command);
     1785    mr_free(tmp);
     1786    mr_free(filelist_name);
     1787    mr_free(filelist_subset_fname);
     1788    mr_free(executable);
     1789    mr_free(temp_log);
     1790    mr_free(xattr_fname);
     1791    mr_free(acl_fname);
    17961792    log_msg(5, "Leaving");
    17971793    return (retval);
     
    19881984    unlink(afio_fname);
    19891985
    1990     paranoid_free(filelist_subset_fname);
    1991     paranoid_free(filelist_fname);
    1992     paranoid_free(afio_fname);
    1993     paranoid_free(command);
    1994     paranoid_free(tmp);
     1986    mr_free(filelist_subset_fname);
     1987    mr_free(filelist_fname);
     1988    mr_free(afio_fname);
     1989    mr_free(command);
     1990    mr_free(tmp);
    19951991    return (retval);
    19961992}
     
    21372133        mvaddstr_and_log_it(g_currentY++, 74, "Done.");
    21382134    }
    2139     paranoid_free(xattr_fname);
    2140     paranoid_free(acl_fname);
    2141     paranoid_free(tmp);
    2142     paranoid_free(biggies_whose_EXATs_we_should_set);
    2143     paranoid_free(pathname_of_last_biggie_restored);
     2135    mr_free(xattr_fname);
     2136    mr_free(acl_fname);
     2137    mr_free(tmp);
     2138    mr_free(biggies_whose_EXATs_we_should_set);
     2139    mr_free(pathname_of_last_biggie_restored);
    21442140    return (retval);
    21452141}
     
    22862282        mvaddstr_and_log_it(g_currentY++, 74, "Done.");
    22872283    }
    2288     paranoid_free(tmp);
    2289     paranoid_free(tarball_fname);
    2290     paranoid_free(progress_str);
    2291     paranoid_free(comment);
     2284    mr_free(tmp);
     2285    mr_free(tarball_fname);
     2286    mr_free(progress_str);
     2287    mr_free(comment);
    22922288
    22932289    return (retval);
     
    24572453        mvaddstr_and_log_it(g_currentY++, 74, "Done.");
    24582454    }
    2459     paranoid_free(biggies_whose_EXATs_we_should_set);
    2460     paranoid_free(pathname_of_last_biggie_restored);
    2461     paranoid_free(biggie_fname);
    2462     paranoid_free(biggie_cksum);
    2463     paranoid_free(xattr_fname);
    2464     paranoid_free(acl_fname);
    2465     paranoid_free(tmp);
     2455    mr_free(biggies_whose_EXATs_we_should_set);
     2456    mr_free(pathname_of_last_biggie_restored);
     2457    mr_free(biggie_fname);
     2458    mr_free(biggie_cksum);
     2459    mr_free(xattr_fname);
     2460    mr_free(acl_fname);
     2461    mr_free(tmp);
    24662462    return (retval);
    24672463}
     
    26032599        mvaddstr_and_log_it(g_currentY++, 74, "Done.");
    26042600    }
    2605     paranoid_free(tmp);
    2606     paranoid_free(progress_str);
    2607     paranoid_free(tmp_fname);
    2608     paranoid_free(xattr_fname);
    2609     paranoid_free(acl_fname);
     2601    mr_free(tmp);
     2602    mr_free(progress_str);
     2603    mr_free(tmp_fname);
     2604    mr_free(xattr_fname);
     2605    mr_free(acl_fname);
    26102606    return (retval);
    26112607}
     
    26922688    kill_petris();
    26932689    log_msg(2, "restore_everything() --- leaving");
    2694     paranoid_free(cwd);
    2695     paranoid_free(newpath);
    2696     paranoid_free(tmp);
     2690    mr_free(cwd);
     2691    mr_free(newpath);
     2692    mr_free(tmp);
    26972693    return (resA + resB);
    26982694}
     
    29142910        g_text_mode = FALSE;
    29152911    }                           // newt :-)
    2916     if (!
    2917         (bkpinfo = g_bkpinfo_DONTUSETHIS =
    2918          malloc(sizeof(struct s_bkpinfo)))) {
    2919         fatal_error("Cannot malloc bkpinfo");
    2920     }
    2921     if (!(mountlist = malloc(sizeof(struct mountlist_itself)))) {
    2922         fatal_error("Cannot malloc mountlist");
    2923     }
    2924     if (!(raidlist = malloc(sizeof(struct raidlist_itself)))) {
    2925         fatal_error("Cannot malloc raidlist");
    2926     }
     2912    bkpinfo = g_bkpinfo_DONTUSETHIS = mr_malloc(sizeof(struct s_bkpinfo));
     2913    mountlist = mr_malloc(sizeof(struct mountlist_itself));
     2914    raidlist = mr_malloc(sizeof(struct raidlist_itself));
    29272915
    29282916    malloc_libmondo_global_strings();
     
    33443332    sprintf(tmp, "umount %s", bkpinfo->isodir);
    33453333    run_program_and_log_output(tmp, 5);
    3346     paranoid_free(mountlist);
    3347     paranoid_free(raidlist);
     3334    mr_free(mountlist);
     3335    mr_free(raidlist);
    33483336    if (am_I_in_disaster_recovery_mode()) {
    33493337        run_program_and_log_output("mount / -o remount,rw", 2);
     
    33513339    paranoid_MR_finish(retval); // frees global stuff plus bkpinfo
    33523340    free_libmondo_global_strings(); // it's fine to have this here :) really :)
    3353     paranoid_free(a);
    3354     paranoid_free(b);
    3355     paranoid_free(tmp);
     3341    mr_free(a);
     3342    mr_free(b);
     3343    mr_free(tmp);
    33563344
    33573345    unlink("/tmp/filelist.full");
  • branches/stable/mondo/src/mondorestore/mondo-rstr-compare.c

    r1067 r1080  
    11/***************************************************************************
    2        mondo-compare.c  -  compares mondoarchive data
    3                              -------------------
    4     begin                : Fri Apr 25 2003
    5     copyright            : (C) 2000 by Hugo Rabson
    6     email                : Hugo Rabson <hugorabson@msn.com>
    7     cvsid                : $Id$
    8 ***************************************************************************/
    9 
    10 /***************************************************************************
    11  *                                                                         *
    12  *   This program is free software; you can redistribute it and/or modify  *
    13  *   it under the terms of the GNU General Public License as published by  *
    14  *   the Free Software Foundation; either version 2 of the License, or     *
    15  *   (at your option) any later version.                                   *
    16  *                                                                         *
    17  ***************************************************************************/
    18 
    19 /***************************************************************************
    20  *                         Change Log                                      *
    21  ***************************************************************************
    22 .
    23 
    24 
    25 
    26 10/21/2003
    27 - changed "/mnt/cdrom" to MNT_CDROM
    28 
    29 10/18
    30 - don't say unknown compressor if no compressor at all
    31 
    32 09/17
    33 - cleaned up logging & conversion-to-changed.txt
    34 - cleaned up compare_mode()
    35 
    36 09/16
    37 - fixed bad malloc(),free() pairs in compare_a_biggiefile()
    38 
    39 09/14
    40 - compare_mode() --- a couple of strings were the wrong way round,
    41   e.g. changed.txt and changed.files
    42 
    43 05/05
    44 - exclude /dev/ * from list of changed files
    45 
    46 04/30
    47 - added textonly mode
    48 
    49 04/27
    50 - improved compare_mode() to allow for ISO/cd/crazy people
    51 
    52 04/25
    53 - first incarnation
     2* compares mondoarchive data
     3* $Id$
    544*/
    55 
    565
    576#include <pthread.h>
     
    207156    }
    208157
    209     paranoid_free(original_cksum_ptr);
    210     paranoid_free(original_cksum);
    211     paranoid_free(bigfile_fname_ptr);
    212     paranoid_free(bigfile_fname);
    213     paranoid_free(checksum_ptr);
    214     paranoid_free(checksum);
    215     paranoid_free(command_ptr);
    216     paranoid_free(command);
    217     paranoid_free(tmp_ptr);
    218     paranoid_free(tmp);
     158    mr_free(original_cksum_ptr);
     159    mr_free(original_cksum);
     160    mr_free(bigfile_fname_ptr);
     161    mr_free(bigfile_fname);
     162    mr_free(checksum_ptr);
     163    mr_free(checksum);
     164    mr_free(command_ptr);
     165    mr_free(command);
     166    mr_free(tmp_ptr);
     167    mr_free(tmp);
    219168
    220169    return (retval);
     
    395344    }
    396345    unlink(logfile);
    397     paranoid_free(command);
    398     paranoid_free(tmp);
    399     paranoid_free(filelist_name);
    400     paranoid_free(logfile);
     346    mr_free(command);
     347    mr_free(tmp);
     348    mr_free(filelist_name);
     349    mr_free(logfile);
    401350    malloc_string(archiver_exe);
    402351    malloc_string(compressor_exe);
     
    494443        mvaddstr_and_log_it(g_currentY++, 74, "Done.");
    495444    }
    496     paranoid_free(tarball_fname);
    497     paranoid_free(progress_str);
    498     paranoid_free(tmp);
     445    mr_free(tarball_fname);
     446    mr_free(progress_str);
     447    mr_free(tmp);
    499448    return (retval);
    500449}
     
    555504    }
    556505
    557     paranoid_free(tmp);
    558     paranoid_free(cwd);
    559     paranoid_free(new);
    560     paranoid_free(command);
     506    mr_free(tmp);
     507    mr_free(cwd);
     508    mr_free(new);
     509    mr_free(command);
    561510
    562511    return (resA + resB);
     
    663612    }
    664613    kill_petris();
    665     paranoid_free(tmp);
     614    mr_free(tmp);
    666615    return (retval);
    667616}
     
    717666
    718667    mvaddstr_and_log_it(g_currentY++, 74, "Done.");
    719     paranoid_free(dir);
    720     paranoid_free(command);
     668    mr_free(dir);
     669    mr_free(command);
    721670    return (res);
    722671}
     
    761710        mvaddstr_and_log_it(g_currentY++, 74, "Done.");
    762711    }
    763     paranoid_free(dir);
    764     paranoid_free(command);
     712    mr_free(dir);
     713    mr_free(command);
    765714    return (res);
    766715}
  • branches/stable/mondo/src/mondorestore/mondo-rstr-newt.c

    r738 r1080  
    11/***************************************************************************
    2 mondo-rstr-newt.c  -  description
    3 -----------------
    4 
    5 begin: Fri Apr 19 16:40:35 EDT 2002
    6 copyright : (C) 2002 Mondo  Hugo Rabson
    7 email     : Hugo Rabson <hugorabson@msn.com>
    8 edited by : by Stan Benoit 4/2002
    9 email     : troff@nakedsoul.org
    10 cvsid     : $Id$
    11 ***************************************************************************/
    12 
    13 /***************************************************************************
    14  *                                                                         *
    15  *   This program is free software; you can redistribute it and/or modify  *
    16  *   it under the terms of the GNU General Public License as published by  *
    17  *   the Free Software Foundation; either version 2 of the License, or     *
    18  *   (at your option) any later version.                                   *
    19  *                                                                         *
    20  ***************************************************************************/
    21 /* mondo-rstr-newt.c               Hugo Rabson
    22 
    23 
    24 07/12
    25 - wider mountlist entry editor window
    26 
    27 03/28/2004
    28 - removed g_mountlist_fname
    29 
    30 07/02/2003
    31 - fixed calls to popup_and_get_string()
    32 
    33 06/05
    34 - cleaned up get_isodir_info()
    35 
    36 05/02
    37 - added strip_path() to improve file list display for long paths (Conor)
    38 
    39 04/24
    40 - added lots of assert()'s and log_OS_error()'s
    41 
    42 04/08/2003
    43 - commented out call to sort_mountlist_by_device(), just in case it's
    44   futzing with LVM/RAID users
    45 
    46 08/21/2002
    47 - fix MOUNTLIST_FNAME and RAIDTAB_FNAME if Reload button finds them empty
    48 
    49 08/19
    50 - fixed what_number_cd_is_this() to take bkpinfo as parameter
    51 
    52 07/01 - 07/31
    53 - renamed from mondo-newt.c to mondo-rstr-newt.c
    54 - moved lots of subroutines to libmondo-newt.c
    55 - added hooks to libmondo
    56 - better handling of yes/no/YES/NO
    57 - better "% done" feedback (Philippe de Muyter)
    58 
    59 05/01 - 06/30
    60 - trim trailing \n from fgets() in a couple of functions
    61 - expanded "May I write mountlist?" message
    62 - replace scanf() with a properly restricted fgets() (Troff)
    63 
    64 02/01 - 02/28/2002
    65 - allow up to 50 chars in popup_and_get_string()'s input field
    66 - if g_current_progress > g_maximum_progress then g_current_progress=g_max...
    67   to stop the progress bar from shooting off the RHS of the screen :)
    68 - beefed up the RAID-related logging a bit
    69 - don't complain if partition format is a number (1-255)
    70 - if hard disk does not exist then warn user when editing mountlist
    71 - when running 'eject -t', log its output
    72 
    73 [...]
    74 
    75 08/09/2001
    76 - created
     2 * $Id$
    773*/
     4
     5#include "mr_mem.h"
    786
    797
     
    16501578    malloc_string(sz_parity_disks);
    16511579    malloc_string(sz_failed_disks);
    1652     if (!(bkp_raidrec = malloc(sizeof(struct raid_device_record)))) {
    1653         fatal_error("Cannot malloc space for raidrec");
    1654     }
     1580    bkp_raidrec = mr_malloc(sizeof(struct raid_device_record));
    16551581
    16561582    log_it("Started edit_raidlist_entry");
     
    17271653        calculate_raid_device_size(mountlist, raidlist,
    17281654                                   raidrec->raid_device);
    1729     paranoid_free(title_of_editraidForm_window);
    1730     paranoid_free(sz_raid_level);
    1731     paranoid_free(sz_data_disks);
    1732     paranoid_free(sz_spare_disks);
    1733     paranoid_free(sz_parity_disks);
    1734     paranoid_free(sz_failed_disks);
    1735     paranoid_free(bkp_raidrec);
     1655    mr_free(title_of_editraidForm_window);
     1656    mr_free(sz_raid_level);
     1657    mr_free(sz_data_disks);
     1658    mr_free(sz_spare_disks);
     1659    mr_free(sz_parity_disks);
     1660    mr_free(sz_failed_disks);
     1661    mr_free(bkp_raidrec);
    17361662#endif
    17371663}
     
    17811707    struct mountlist_itself *unallocparts;
    17821708
    1783     unallocparts = malloc(sizeof(struct mountlist_itself));
     1709    unallocparts = mr_malloc(sizeof(struct mountlist_itself));
    17841710
    17851711    log_it("Started edit_raidlist_entry");
     
    28162742    malloc_string(sz_res);
    28172743    malloc_string(header_text);
    2818     if (!(bkp_raidrec = malloc(sizeof(struct raid_device_record)))) {
    2819         fatal_error("Cannot malloc space for raidrec");
    2820     }
    2821     if (!(bkp_disklist = malloc(sizeof(struct list_of_disks)))) {
    2822         fatal_error("Cannot malloc space for disklist");
    2823     }
    2824     if (!(bkp_raidlist = malloc(sizeof(struct raidlist_itself)))) {
    2825         fatal_error("Cannot malloc space for raidlist");
    2826     }
    2827     if (!
    2828         (unallocated_raid_partitions =
    2829          malloc(sizeof(struct mountlist_itself)))) {
    2830         fatal_error("Cannot malloc space for unallocated_raid_partitions");
    2831     }
     2744    bkp_raidrec = mr_malloc(sizeof(struct raid_device_record));
     2745    bkp_disklist = mr_malloc(sizeof(struct list_of_disks));
     2746    bkp_raidlist = mr_malloc(sizeof(struct raidlist_itself));
     2747    unallocated_raid_partitions = mr_malloc(sizeof(struct mountlist_itself));
    28322748
    28332749    memcpy((void *) bkp_raidlist, (void *) raidlist,
     
    29202836               sizeof(struct list_of_disks));
    29212837    }
    2922     paranoid_free(tmp);
    2923     paranoid_free(help_text);
    2924     paranoid_free(title_of_window);
    2925     paranoid_free(sz_res);
    2926     paranoid_free(header_text);
    2927     paranoid_free(bkp_raidrec);
    2928     paranoid_free(bkp_disklist);
    2929     paranoid_free(bkp_raidlist);
    2930     paranoid_free(unallocated_raid_partitions);
     2838    mr_free(tmp);
     2839    mr_free(help_text);
     2840    mr_free(title_of_window);
     2841    mr_free(sz_res);
     2842    mr_free(header_text);
     2843    mr_free(bkp_raidrec);
     2844    mr_free(bkp_disklist);
     2845    mr_free(bkp_raidlist);
     2846    mr_free(unallocated_raid_partitions);
    29312847}
    29322848#endif
  • branches/stable/mondo/src/mondorestore/mondo-rstr-tools.c

    r1067 r1080  
    11/***************************************************************************
    2 mondo-rstr-tools.c  -  description
    3 -----------------
    4 
    5 begin: Sun Sep 21 16:40:35 EDT 2003
    6 copyright : (C) 2002 Mondo  Hugo Rabson
    7 email     : Hugo Rabson <hugorabson@msn.com>
    8 edited by : by Stan Benoit ?/2003
    9 email     : troff@nakedsoul.org
    10 cvsid     : $Id: mondo-rstr-tools.c
    11 ***************************************************************************/
    12 
    13 /***************************************************************************
    14  *                                                                         *
    15  *   This program is free software; you can redistribute it and/or modify  *
    16  *   it under the terms of the GNU General Public License as published by  *
    17  *   the Free Software Foundation; either version 2 of the License, or     *
    18  *   (at your option) any later version.                                   *
    19  *                                                                         *
    20  ***************************************************************************/
    21 /* mondo-rstr-tools.c               Hugo Rabson
    22 
    23 
    24 07/27
    25 - if the user is foolish enough to use /dev/md0 as boot device,
    26   call lilo -M /dev/hda to make sure lilo does its job properly
    27 - better NFS+nuke support
    28 
    29 07/20
    30 - use backup's i-want-my-lvm file
    31 - be sure to use archives' raidtab when restoring
    32 
    33 07/18
    34 - use /tmp/isodir for NFS if DR mode
    35 - better support of users who boot from LVM CD and nuke-restore non-LVM backups
    36 
    37 07/12
    38 - bugfix to allow user to burn ISOs to CDs and restore from CDs (not original src)
    39 
    40 06/29
    41 - mount ext3 partitions as ext2, just in case :)
    42 
    43 06/26
    44 - delete make_relevant_partition_bootable()
    45 
    46 06/19
    47 - futzed with the call to mount floppy, to stop it from locking up on my AMD64 system
    48 
    49 06/14
    50 - shell out to /mnt/RESTORING chroot in order to let user install GRUB
    51   manually if automatic GRUB installation fails
    52 
    53 06/15
    54 - Added check for different 'isodir' chosen by user than stored in the archive
    55   Conor Daly <conor.daly@met.ie>
    56 
    57 04/17
    58 - replaced INTERNAL_TAPE_BLK_SIZE with bkpinfo->internal_tape_block_size
    59 
    60 04/09
    61 - don't try to mount CD if tape bkp
    62 
    63 04/03
    64 - trying to copy tmp/mondo-restore.cfg to itself - silly! - fixed
    65 
    66 04/02
    67 - when extracting cfg file and mountlist from all.tar.gz (tape copy),
    68   use block size of INTERNAL_TAPE_BLK_SIZE, not TAPE_BLOCK_SIZE
    69 
    70 02/21
    71 - don't use 'mv -v' cos Busybox won't support it
    72 
    73 02/09
    74 - make hole for cfg file before moving it (line 2094 or so)
    75 
    76 02/03
    77 - changed a couple of refs to filelist.full, to filelist.full.gz
    78 
    79 01/16/2004
    80 - instead of copying filelist, use 'ln -sf' to link to original;
    81   saves space
    82 
    83 11/20/2003
    84 - also retrieve /tmp/mountlist.txt if user wants
    85 
    86 11/16
    87 - fixed NFS path bug affecting the extractions of filelist/biggielist
    88   during selective restore
    89 
    90 11/02
    91 - fixed mount_cdrom() to run properly w/ nfs restores
    92 - mount_device() returns 0 if swap mount fails cos swap isn't crucial
    93 
    94 10/17
    95 - run_grub() uses MNT_RESTORING instead of "/mnt/RESTORING"
    96 
    97 10/26
    98 - cleaned up run_grub()
    99 
    100 10/25
    101 - fixed mount_cdrom() to run properly w/ nfs restores
    102 
    103 10/21
    104 - mount_device() returns 0 if swap mount fails cos swap isn't crucial
    105 
    106 10/15
    107 - run_grub() now uses its initiative instead
    108   of calling grub-install
    109 
    110 10/10
    111 - don't leave copies of filelist.full lying around, clogging up
    112   the ramdisk, there's a good fellow :-)
    113 
    114 10/02
    115 - added 'dvd' to the range of media types I'll understand
    116 - fixed iso->cdr problem (thanks, Stan Benoit & Fred Beondo)
    117 
    118 09/24
    119 - try lots of tape devs if /dev/st0 fails
    120 
    121 09/23/2003
    122 - first incarnation
     2 * $Id$
    1233*/
    1244
     
    13212//#include "mondo-rstr-compare-EXT.h"
    13313#include "mondo-rstr-tools.h"
     14#include "mr_mem.h"
    13415
    13516extern bool g_sigpipe_caught;
     
    17455void free_MR_global_filenames()
    17556{
    176     paranoid_free(g_biggielist_txt);
    177     paranoid_free(g_filelist_full);
    178     paranoid_free(g_filelist_imagedevs);
    179 //  paranoid_free (g_imagedevs_pot );
    180     paranoid_free(g_imagedevs_restthese);
    181     paranoid_free(g_mondo_cfg_file);
    182     paranoid_free(g_mountlist_fname);
    183     paranoid_free(g_mondo_home);
    184     paranoid_free(g_tmpfs_mountpt);
    185     paranoid_free(g_isodir_device);
    186     paranoid_free(g_isodir_format);
     57    mr_free(g_biggielist_txt);
     58    mr_free(g_filelist_full);
     59    mr_free(g_filelist_imagedevs);
     60//  mr_free (g_imagedevs_pot );
     61    mr_free(g_imagedevs_restthese);
     62    mr_free(g_mondo_cfg_file);
     63    mr_free(g_mountlist_fname);
     64    mr_free(g_mondo_home);
     65    mr_free(g_tmpfs_mountpt);
     66    mr_free(g_isodir_device);
     67    mr_free(g_isodir_format);
    18768
    18869}
     
    21394    assert_string_is_neither_NULL_nor_zerolength(outfname);
    21495
    215     incoming_ptr = malloc(sizeof(incoming));
    216     if (incoming_ptr == NULL) {
    217         fprintf(stderr, "Out of Memory\n");
    218         exit(EXIT_FAILURE);
    219     }
    220 
    221     question_ptr = malloc(sizeof(question));
    222     if (question_ptr == NULL) {
    223         fprintf(stderr, "Out of Memory\n");
    224         exit(EXIT_FAILURE);
    225     }
     96    incoming_ptr = mr_malloc(sizeof(incoming));
     97    question_ptr = mr_malloc(sizeof(question));
    22698
    22799    memset(incoming_ptr, '\0', sizeof(incoming));
     
    253125
    254126  /*** free memory ***********/
    255     paranoid_free(incoming_ptr);
     127    mr_free(incoming_ptr);
    256128    incoming_ptr = NULL;
    257     paranoid_free(question_ptr);
     129    mr_free(question_ptr);
    258130    question_ptr = NULL;
    259131
     
    341213        retval = 0;
    342214    }
    343     paranoid_free(mountpt);
    344     paranoid_free(command);
    345     paranoid_free(orig_fname);
     215    mr_free(mountpt);
     216    mr_free(command);
     217    mr_free(orig_fname);
    346218    return (retval);
    347219
     
    406278    sprintf(command, "grep -E '^%s$' %s", file, list_fname);
    407279    res = run_program_and_log_output(command, FALSE);
    408     paranoid_free(command);
    409     paranoid_free(file);
    410     paranoid_free(tmp);
     280    mr_free(command);
     281    mr_free(file);
     282    mr_free(tmp);
    411283    if (res) {
    412284        return (FALSE);
     
    500372    log_msg(2, "%ld: bkpinfo->isodir is now %s", __LINE__,
    501373            bkpinfo->isodir);
    502     paranoid_free(mount_isodir_command);
    503     paranoid_free(tmp);
    504     paranoid_free(command);
     374    mr_free(mount_isodir_command);
     375    mr_free(tmp);
     376    mr_free(command);
    505377    return (retval);
    506378}
     
    519391            "kill `ps 2> /dev/null | grep petris 2> /dev/null | grep -v grep | cut -d' ' -f2` 2> /dev/null");
    520392    paranoid_system(command);
    521     paranoid_free(command);
     393    mr_free(command);
    522394}
    523395
     
    556428    }
    557429    if (!does_file_exist(rclocal_fname)) {
    558         paranoid_free(rclocal_fname);
    559         paranoid_free(newfile_fname);
    560         paranoid_free(tmp);
     430        mr_free(rclocal_fname);
     431        mr_free(newfile_fname);
     432        mr_free(tmp);
    561433        return (1);
    562434    }
     
    582454    sprintf(tmp, "chmod +x \"%s\"", newfile_fname);
    583455    run_program_and_log_output(tmp, FALSE);
    584     paranoid_free(rclocal_fname);
    585     paranoid_free(newfile_fname);
    586     paranoid_free(tmp);
     456    mr_free(rclocal_fname);
     457    mr_free(newfile_fname);
     458    mr_free(tmp);
    587459    return (0);
    588460}
     
    613485    malloc_string(these_failed);
    614486    assert(p_external_copy_of_mountlist != NULL);
    615     mountlist = malloc(sizeof(struct mountlist_itself));
     487    mountlist = mr_malloc(sizeof(struct mountlist_itself));
    616488    memcpy((void *) mountlist, (void *) p_external_copy_of_mountlist,
    617489           sizeof(struct mountlist_itself));
     
    684556    }
    685557    run_program_and_log_output("df -m", 3);
    686     paranoid_free(mountlist);
    687     paranoid_free(tmp);
    688     paranoid_free(format);
    689     paranoid_free(these_failed);
     558    mr_free(mountlist);
     559    mr_free(tmp);
     560    mr_free(format);
     561    mr_free(these_failed);
    690562    return (retval);
    691563}
     
    720592        || bkpinfo->backup_media_type == udev) {
    721593        log_msg(8, "Tape/udev. Therefore, no need to mount CDROM.");
    722         paranoid_free(mount_cmd);
     594        mr_free(mount_cmd);
    723595        return 0;
    724596    }
     
    726598    if (!run_program_and_log_output("mount | grep -F " MNT_CDROM, FALSE)) {
    727599        log_msg(2, "mount_cdrom() - CD already mounted. Fair enough.");
    728         paranoid_free(mount_cmd);
     600        mr_free(mount_cmd);
    729601        return (0);
    730602    }
     
    807679        log_msg(2, "Mounted CD-ROM drive OK");
    808680    }
    809     paranoid_free(mount_cmd);
     681    mr_free(mount_cmd);
    810682    return (res);
    811683}
     
    918790    }
    919791
    920     paranoid_free(tmp);
    921     paranoid_free(command);
    922     paranoid_free(mountdir);
    923     paranoid_free(mountpoint);
    924     paranoid_free(additional_parameters);
     792    mr_free(tmp);
     793    mr_free(command);
     794    mr_free(mountdir);
     795    mr_free(mountpoint);
     796    mr_free(additional_parameters);
    925797
    926798    return (res);
     
    1107979    read_cfg_var(cfg_file, "acl", value);
    1108980    if (strstr(value, "TRUE")) {
    1109         asprintf(&g_getfacl,"setfacl");
     981        mr_asprintf(&g_getfacl,"setfacl");
    1110982        log_msg(1, "We will restore ACLs");
    1111983        if (! find_home_of_exe("setfacl")) {
     
    1115987    read_cfg_var(cfg_file, "xattr", value);
    1116988    if (strstr(value, "TRUE")) {
    1117         asprintf(&g_getfattr,"setfattr");
     989        mr_asprintf(&g_getfattr,"setfattr");
    1118990        log_msg(1, "We will restore XATTRs");
    1119991        if (! find_home_of_exe("setfattr")) {
     
    12901162    }
    12911163    g_backup_media_type = bkpinfo->backup_media_type;
    1292     paranoid_free(value);
    1293     paranoid_free(tmp);
    1294     paranoid_free(command);
    1295     paranoid_free(iso_mnt);
    1296     paranoid_free(iso_path);
    1297     paranoid_free(old_isodir);
     1164    mr_free(value);
     1165    mr_free(tmp);
     1166    mr_free(command);
     1167    mr_free(iso_mnt);
     1168    mr_free(iso_path);
     1169    mr_free(old_isodir);
    12981170    return (0);
    12991171
     
    14801352    }
    14811353
    1482     paranoid_free(command);
    1483     paranoid_free(tmp);
     1354    mr_free(command);
     1355    mr_free(tmp);
    14841356    return (filelist);
    14851357}
     
    15141386
    15151387    res = run_program_and_log_output(command, 5);
    1516     paranoid_free(tmp);
    1517     paranoid_free(command);
     1388    mr_free(tmp);
     1389    mr_free(command);
    15181390    return (res);
    15191391}
     
    15931465        log_to_screen("Your boot loader ran OK");
    15941466    }
    1595     paranoid_free(device);
    1596     paranoid_free(tmp);
    1597     paranoid_free(name);
     1467    mr_free(device);
     1468    mr_free(tmp);
     1469    mr_free(name);
    15981470    return (retval);
    15991471}
     
    17391611        mvaddstr_and_log_it(g_currentY++, 74, "Done.");
    17401612    }
    1741     paranoid_free(rootdev);
    1742     paranoid_free(rootdrive);
    1743     paranoid_free(conffile);
    1744     paranoid_free(command);
    1745     paranoid_free(boot_device);
    1746     paranoid_free(tmp);
    1747     paranoid_free(editor);
     1613    mr_free(rootdev);
     1614    mr_free(rootdrive);
     1615    mr_free(conffile);
     1616    mr_free(command);
     1617    mr_free(boot_device);
     1618    mr_free(tmp);
     1619    mr_free(editor);
    17481620
    17491621    return (res);
     
    18131685        res = TRUE;
    18141686    }
    1815     paranoid_free(command);
    1816     paranoid_free(tmp);
    1817     paranoid_free(editor);
     1687    mr_free(command);
     1688    mr_free(tmp);
     1689    mr_free(editor);
    18181690    return (res);
    18191691}
     
    19241796                                   " lilo -M /dev/sda", 3);
    19251797    }
    1926     paranoid_free(command);
    1927     paranoid_free(tmp);
    1928     paranoid_free(editor);
     1798    mr_free(command);
     1799    mr_free(tmp);
     1800    mr_free(editor);
    19291801    return (res);
    19301802}
     
    20061878        mvaddstr_and_log_it(g_currentY++, 74, "Done.");
    20071879    }
    2008     paranoid_free(command);
    2009     paranoid_free(boot_device);
    2010     paranoid_free(tmp);
    2011     paranoid_free(editor);
     1880    mr_free(command);
     1881    mr_free(boot_device);
     1882    mr_free(tmp);
     1883    mr_free(editor);
    20121884    return (res);
    20131885}
     
    21292001    paranoid_fclose(fout);
    21302002    paranoid_fclose(fin);
    2131     paranoid_free(incoming);
     2003    mr_free(incoming);
    21322004}
    21332005
     
    21772049    }
    21782050    close_progress_form();
    2179     paranoid_free(tmp);
     2051    mr_free(tmp);
    21802052}
    21812053
     
    22222094    assert(p_external_copy_of_mountlist != NULL);
    22232095
    2224     mountlist = malloc(sizeof(struct mountlist_itself));
     2096    mountlist = mr_malloc(sizeof(struct mountlist_itself));
    22252097    memcpy((void *) mountlist, (void *) p_external_copy_of_mountlist,
    22262098           sizeof(struct mountlist_itself));
     
    23062178        log_to_screen("All partitions were unmounted OK.");
    23072179    }
    2308     free(mountlist);
    2309     paranoid_free(command);
    2310     paranoid_free(tmp);
     2180    mr_free(mountlist);
     2181    mr_free(command);
     2182    mr_free(tmp);
    23112183    return (retval);
    23122184}
     
    23462218        res = 0;
    23472219    }
    2348     paranoid_free(command);
     2220    mr_free(command);
    23492221    return (res);
    23502222}
     
    26102482    run_program_and_log_output(command, FALSE);
    26112483    g_backup_media_type = bkpinfo->backup_media_type;
    2612     paranoid_free(device);
    2613     paranoid_free(command);
    2614     paranoid_free(tmp);
    2615     paranoid_free(cfg_file);
    2616     paranoid_free(mounted_cfgf_path);
    2617     paranoid_free(mountpt);
    2618     paranoid_free(ramdisk_fname);
    2619     paranoid_free(mountlist_file);
     2484    mr_free(device);
     2485    mr_free(command);
     2486    mr_free(tmp);
     2487    mr_free(cfg_file);
     2488    mr_free(mounted_cfgf_path);
     2489    mr_free(mountpt);
     2490    mr_free(ramdisk_fname);
     2491    mr_free(mountlist_file);
    26202492    return (retval);
    26212493}
     
    26492521
    26502522    malloc_string(screen_message);
    2651     raidlist = malloc(sizeof(struct raidlist_itself));
     2523    raidlist = mr_malloc(sizeof(struct raidlist_itself));
    26522524
    26532525    assert(wait_for_percentage <= 100);
     
    26842556        }
    26852557    }
    2686     paranoid_free(screen_message);
    2687     paranoid_free(raidlist);
    2688 }
     2558    mr_free(screen_message);
     2559    mr_free(raidlist);
     2560}
Note: See TracChangeset for help on using the changeset viewer.