Changeset 2405 in MondoRescue for branches/2.2.10/mondo/src/common


Ignore:
Timestamp:
Sep 17, 2009, 3:45:24 AM (15 years ago)
Author:
Bruno Cornec
Message:

Removes some malloc_string static allocation

Location:
branches/2.2.10/mondo/src/common
Files:
9 edited

Legend:

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

    r2383 r2405  
    979979void *create_afio_files_in_background(void *inbuf)
    980980{
    981     long int archiving_set_no;
    982     char *archiving_filelist_fname;
    983     char *archiving_afioball_fname;
     981    long int archiving_set_no = 0L;
     982    char *archiving_filelist_fname = NULL;
     983    char *archiving_afioball_fname = NULL;
    984984    char *curr_xattr_list_fname = NULL;
    985985    char *curr_acl_list_fname = NULL;
     
    994994    int this_thread_no = g_current_thread_no++;
    995995
    996     malloc_string(archiving_filelist_fname);
    997     malloc_string(archiving_afioball_fname);
    998996    p_last_set_archived = (int *) inbuf;
    999997    p_archival_threads_running = (int *) (inbuf + 4);
     
    10021000    bkpinfo_bis = (struct s_bkpinfo *) (inbuf + BKPINFO_LOC_OFFSET);
    10031001
    1004     sprintf(archiving_filelist_fname, FILELIST_FNAME_RAW_SZ, bkpinfo->tmpdir, 0L);
    1005     for (archiving_set_no = 0; does_file_exist(archiving_filelist_fname);
    1006          sprintf(archiving_filelist_fname, FILELIST_FNAME_RAW_SZ, bkpinfo->tmpdir, archiving_set_no)) {
     1002    mr_asprintf(archiving_filelist_fname, FILELIST_FNAME_RAW_SZ, bkpinfo->tmpdir, 0L);
     1003
     1004    while (does_file_exist(archiving_filelist_fname)) {
    10071005        if (g_exiting) {
     1006            mr_free(archiving_filelist_fname);
    10081007            fatal_error("Execution run aborted (pthread)");
    10091008        }
    10101009        if (archiving_set_no >= MAX_NOOF_SETS_HERE) {
     1010            mr_free(archiving_filelist_fname);
    10111011            fatal_error("Maximum number of filesets exceeded. Adjust MAX_NOOF_SETS_HERE, please.");
    10121012        }
    10131013        if (!semaphore_p()) {
    10141014            log_msg(3, "P sem failed (pid=%d)", (int) getpid());
     1015            mr_free(archiving_filelist_fname);
    10151016            fatal_error("Cannot get semaphore P");
    10161017        }
     
    10201021        *p_next_set_to_archive = *p_next_set_to_archive + 1;
    10211022        if (!semaphore_v()) {
     1023            mr_free(archiving_filelist_fname);
    10221024            fatal_error("Cannot get semaphore V");
    10231025        }
    10241026
    10251027        /* backup this set of files */
    1026         sprintf(archiving_afioball_fname, AFIOBALL_FNAME_RAW_SZ, bkpinfo->tmpdir, archiving_set_no, bkpinfo->zip_suffix);
    1027         sprintf(archiving_filelist_fname, FILELIST_FNAME_RAW_SZ, bkpinfo->tmpdir, archiving_set_no);
     1028        mr_asprintf(archiving_afioball_fname, AFIOBALL_FNAME_RAW_SZ, bkpinfo->tmpdir, archiving_set_no, bkpinfo->zip_suffix);
     1029        mr_free(archiving_filelist_fname);
     1030        mr_asprintf(archiving_filelist_fname, FILELIST_FNAME_RAW_SZ, bkpinfo->tmpdir, archiving_set_no);
    10281031        if (!does_file_exist(archiving_filelist_fname)) {
    1029             log_msg(3,
    1030                     "%s[%d:%d] - well, I would archive %d, except that it doesn't exist. I'll stop now.",
    1031                     FORTY_SPACES, getpid(), this_thread_no,
    1032                     archiving_set_no);
     1032            log_msg(3, "[%d:%d] - well, I would archive %d, except that it doesn't exist. I'll stop now.", getpid(), this_thread_no, archiving_set_no);
    10331033            break;
    10341034        }
     
    10361036        mr_asprintf(tmp, AFIOBALL_FNAME_RAW_SZ, bkpinfo->tmpdir, archiving_set_no - ARCH_BUFFER_NUM, bkpinfo->zip_suffix);
    10371037        if (does_file_exist(tmp)) {
    1038             log_msg(4, "%s[%d:%d] - waiting for storer", FORTY_SPACES,
    1039                     getpid(), this_thread_no);
     1038            log_msg(4, "[%d:%d] - waiting for storer", getpid(), this_thread_no);
    10401039            while (does_file_exist(tmp)) {
    10411040                sleep(1);
     
    10451044        mr_free(tmp);
    10461045
    1047         log_msg(4, "%s[%d:%d] - EXATing %d...", FORTY_SPACES, getpid(),
    1048                 this_thread_no, archiving_set_no);
     1046        log_msg(4, "[%d:%d] - EXATing %d...", getpid(), this_thread_no, archiving_set_no);
     1047
    10491048        if (g_getfattr) {
    10501049            mr_asprintf(curr_xattr_list_fname, XATTR_LIST_FNAME_RAW_SZ, bkpinfo->tmpdir, archiving_set_no);
     
    10581057        }
    10591058
    1060         log_msg(4, "%s[%d:%d] - archiving %d...", FORTY_SPACES, getpid(),
    1061                 this_thread_no, archiving_set_no);
    1062         res =
    1063             archive_this_fileset(archiving_filelist_fname,
    1064                                  archiving_afioball_fname,
    1065                                  archiving_set_no);
     1059        log_msg(4, "[%d:%d] - archiving %d...", getpid(), this_thread_no, archiving_set_no);
     1060        res = archive_this_fileset(archiving_filelist_fname, archiving_afioball_fname, archiving_set_no);
     1061        mr_free(archiving_afioball_fname);
     1062
    10661063        retval += res;
    10671064
     
    10691066            log_to_screen("Errors occurred while archiving set %ld. Please review logs.", archiving_set_no);
    10701067        }
     1068
    10711069        if (!semaphore_p()) {
     1070            mr_free(archiving_filelist_fname);
    10721071            fatal_error("Cannot get semaphore P");
    10731072        }
     
    10801079
    10811080        if (!semaphore_v()) {
     1081            mr_free(archiving_filelist_fname);
    10821082            fatal_error("Cannot get semaphore V");
    10831083        }
    1084         log_msg(4, "%s[%d:%d] - archived %d OK", FORTY_SPACES, getpid(),
    1085                 this_thread_no, archiving_set_no);
     1084        log_msg(4, "[%d:%d] - archived %d OK", getpid(), this_thread_no, archiving_set_no);
    10861085        archiving_set_no++;
    1087     }
     1086
     1087        mr_free(archiving_filelist_fname);
     1088        mr_asprintf(archiving_filelist_fname, FILELIST_FNAME_RAW_SZ, bkpinfo->tmpdir, archiving_set_no);
     1089    }
     1090    mr_free(archiving_filelist_fname);
     1091
    10881092    if (!semaphore_p()) {
    10891093        fatal_error("Cannot get semaphore P");
     
    10931097        fatal_error("Cannot get semaphore V");
    10941098    }
    1095     log_msg(3, "%s[%d:%d] - exiting", FORTY_SPACES, getpid(),
    1096             this_thread_no);
    1097     paranoid_free(archiving_filelist_fname);
    1098     paranoid_free(archiving_afioball_fname);
     1099    log_msg(3, "[%d:%d] - exiting", getpid(), this_thread_no);
    10991100    pthread_exit(NULL);
    11001101}
     
    13271328    assert(bkpinfo != NULL);
    13281329    malloc_string(result_str);
    1329     transfer_block =
    1330         malloc(sizeof(struct s_bkpinfo) + BKPINFO_LOC_OFFSET + 64);
     1330    transfer_block = malloc(sizeof(struct s_bkpinfo) + BKPINFO_LOC_OFFSET + 64);
    13311331    memset((void *) transfer_block, 0,
    13321332           sizeof(struct s_bkpinfo) + BKPINFO_LOC_OFFSET + 64);
     
    16381638    char *message_to_screen = NULL;
    16391639    char *sz_blank_disk = NULL;
    1640     char *fnam;
    16411640    char *tmp2 = NULL;
    16421641    char *tmp3 = NULL;
     
    16451644
    16461645    malloc_string(old_pwd);
    1647     malloc_string(fnam);
    16481646    assert(bkpinfo != NULL);
    16491647    assert_string_is_neither_NULL_nor_zerolength(destfile);
     
    18791877    }
    18801878    paranoid_free(old_pwd);
    1881     paranoid_free(fnam);
    18821879    return (retval);
    18831880}
     
    25292526/**
    25302527 * Make sure the user has a valid CD-R(W) in the CD drive.
    2531  * @param cdrw_dev Set to the CD-R(W) device checked.
    2532  * @param keep_looping If TRUE, keep pestering user until they insist
    2533  * or insert a correct CD; if FALSE, only check once.
    2534  * @return 0 (there was an OK CD in the drive) or 1 (there wasn't).
    2535  */
    2536 int interrogate_disk_currently_in_cdrw_drive(char *cdrw_dev, bool keep_looping) {
    2537     int res = 0;
    2538     char *bkp = NULL;
     2528 * @return the CD-R(W) device checked or NULL
     2529 */
     2530char *interrogate_disk_currently_in_cdrw_drive(char *cdrw_dev) {
    25392531    char *cdrecord = NULL;
    2540 
    2541     mr_asprintf(bkp, "%s", cdrw_dev);
    2542     if (find_cdrw_device(cdrw_dev)) {
    2543         strcpy(cdrw_dev, bkp);
    2544     } else {
     2532    char *cdrw_dev = NULL;
     2533
     2534    cdrw_dev = find_cdrw_device();
     2535    if (cdrw_dev != NULL) {
    25452536        if (!system("which cdrecord > /dev/null 2> /dev/null")) {
    25462537            mr_asprintf(cdrecord, "cdrecord dev=%s -atip", cdrw_dev);
     
    25512542        }
    25522543        if (cdrecord != NULL) {
    2553             if (!keep_looping) {
    2554                 retract_CD_tray_and_defeat_autorun();
    2555                 res = run_program_and_log_output(cdrecord, 5);
    2556             } else {
    2557                 while ((res = run_program_and_log_output(cdrecord, 5))) {
    2558                     retract_CD_tray_and_defeat_autorun();
    2559                     if (ask_me_yes_or_no
    2560                         ("Unable to examine CD. Are you sure this is a valid CD-R(W) CD?"))
    2561                     {
    2562                         log_msg(1, "Well, he insisted...");
    2563                         break;
    2564                     }
    2565                 }
     2544            retract_CD_tray_and_defeat_autorun();
     2545            if (run_program_and_log_output(cdrecord, 5)) {
     2546                /* As it didn't work, return NULL */
     2547                mr_free(cdrw_dev);
    25662548            }
    25672549        }
    2568     }
    2569     mr_free(bkp);
    2570 
    2571     mr_free(cdrecord);
    2572     return (res);
     2550        mr_free(cdrecord);
     2551    }
     2552    return(cdrw_dev);
    25732553}
    25742554
     
    25862566    char *tmp = NULL;
    25872567    char *cdrom_dev = NULL;
    2588     char *cdrw_dev;
     2568    char *cdrw_dev = NULL;
    25892569    char *our_serial_str = NULL;
    25902570    bool ok_go_ahead_burn_it;
     
    25922572    int attempt_to_mount_returned_this = 999;
    25932573    char *mtpt = NULL;
    2594     char *szcdno;
    2595     char *szserfname;
    2596     char *szunmount;
     2574    char *szcdno = NULL;
     2575    char *szserfname = NULL;
     2576    char *szunmount = NULL;
    25972577    char *mds = NULL;
    2598 
    2599     malloc_string(cdrw_dev);
    2600     malloc_string(szcdno);
    2601     malloc_string(szserfname);
    2602     malloc_string(szunmount);
    26032578
    26042579    mds = media_descriptor_string(g_backup_media_type);
     
    26212596        mr_asprintf(tmp, "umount %s", cdrom_dev);
    26222597        run_program_and_log_output(tmp, 1);
    2623         sprintf(szcdno, "%s/archives/THIS-CD-NUMBER", mtpt);
    2624         sprintf(szserfname, "%s/archives/SERIAL-STRING", mtpt);
    2625         sprintf(szunmount, "umount %s", mtpt);
     2598        mr_asprintf(szcdno, "%s/archives/THIS-CD-NUMBER", mtpt);
     2599        mr_asprintf(szserfname, "%s/archives/SERIAL-STRING", mtpt);
     2600        mr_asprintf(szunmount, "umount %s", mtpt);
    26262601        cd_number = -1;
    26272602        mr_asprintf(tmp, "mount %s %s", cdrom_dev, mtpt);
     
    26292604        attempt_to_mount_returned_this = run_program_and_log_output(tmp, 1);
    26302605        mr_free(tmp);
     2606
    26312607        if (attempt_to_mount_returned_this) {
    26322608            log_msg(4, "Failed to mount %s at %s", cdrom_dev, mtpt);
    26332609            log_to_screen("If there's a CD/DVD in the drive, it's blank.");
    2634             /*
    2635                if (interrogate_disk_currently_in_cdrw_drive(cdrw_dev, FALSE))
    2636                {
    2637                ok_go_ahead_burn_it = FALSE;
    2638                log_to_screen("There isn't a writable CD/DVD in the drive.");
    2639                }
    2640                else
    2641                {
    2642                log_to_screen("Confirmed. There is a blank CD/DVD in the drive.");
    2643                }
    2644              */
    2645         } else if (!does_file_exist(szcdno)
    2646                    || !does_file_exist(szserfname)) {
     2610        } else if (!does_file_exist(szcdno) || !does_file_exist(szserfname)) {
    26472611            mds = media_descriptor_string(g_backup_media_type);
    2648             log_to_screen
    2649                 ("%s has data on it but it's probably not a Mondo CD.", mds);
     2612            log_to_screen("%s has data on it but it's probably not a Mondo CD.", mds);
    26502613            mr_free(mds);
    26512614        } else {
     
    26642627            // FIXME - should be able to use last_line_of_file(), surely?
    26652628        }
     2629        mr_free(szcdno);
     2630        mr_free(szserfname);
     2631
    26662632        run_program_and_log_output(szunmount, 1);
     2633        mr_free(szunmount);
     2634
    26672635        log_msg(2, "paafcd: cd_number = %d", cd_number);
    26682636        log_msg(2, "our serial str = %s; g_serial_string = %s", our_serial_str, g_serial_string);
     
    26862654        log_msg(2,
    26872655                "paafcd: Can't find CD-ROM drive. Perhaps it has a blank %s in it?", mds);
    2688         if (interrogate_disk_currently_in_cdrw_drive(cdrw_dev, FALSE)) {
     2656        cdrw_dev = interrogate_disk_currently_in_cdrw_drive();
     2657        if (cdrw_dev == NULL) {
    26892658            ok_go_ahead_burn_it = FALSE;
    26902659            log_to_screen("There isn't a writable %s in the drive.", mds);
    26912660        }
     2661        mr_free(cdrw_dev);
    26922662        mr_free(mds);
    26932663    }
     
    27092679
    27102680    mds = media_descriptor_string(g_backup_media_type);
    2711     log_msg(2,
    2712             "paafcd: OK, I assume I have a blank/reusable %s in the drive...", mds);
     2681    log_msg(2, "paafcd: OK, I assume I have a blank/reusable %s in the drive...", mds);
    27132682
    27142683    log_to_screen("Proceeding w/ %s in drive.", mds);
    27152684    mr_free(mds);
    27162685
    2717     paranoid_free(cdrw_dev);
    27182686    paranoid_free(mtpt);
    2719     paranoid_free(szcdno);
    2720     paranoid_free(szserfname);
    2721     paranoid_free(szunmount);
    27222687    if (pmountable) {
    27232688        if (attempt_to_mount_returned_this) {
     
    27292694
    27302695}
    2731 
    2732 
    2733 
    2734 
    2735 
    2736 
    27372696
    27382697
     
    27642723
    27652724/* @} - end of utilityGroup */
    2766 
    2767 
    2768 
    2769 
    2770 
    2771 
    27722725
    27732726
  • branches/2.2.10/mondo/src/common/libmondo-cli.c

    r2389 r2405  
    654654
    655655    /*@ buffers ** */
    656     char *tmp = NULL;
    657656    char *tmp1 = NULL;
    658657    char *tmp2 = NULL;
     
    668667
    669668    struct stat buf;
    670 
    671     malloc_string(tmp);
    672669
    673670    assert(bkpinfo != NULL);
     
    13771374        finish(0);
    13781375    }
    1379     mr_free(tmp);
    13801376
    13811377    if ((flag_set['L']) && (! bkpinfo->restore_data)) {
  • branches/2.2.10/mondo/src/common/libmondo-devices.c

    r2400 r2405  
    14071407    char *tmp = NULL;
    14081408    char *p = NULL;
    1409     char *tmp1 = NULL;
    14101409    char *mds = NULL;
    14111410    char *sz_size = NULL;
    14121411    char *command = NULL;
    14131412    char *comment = NULL;
    1414     char *prompt;
    14151413    int i;
    14161414    FILE *fin;
    14171415
    1418     malloc_string(prompt);
    1419     malloc_string(tmp1);
    14201416    assert(bkpinfo != NULL);
    14211417    bkpinfo->nonbootable_backup = FALSE;
     
    14561452        if (archiving_to_media) {
    14571453            if ((bkpinfo->backup_media_type != dvd) && (bkpinfo->backup_media_type != usb)) {
    1458                 if (ask_me_yes_or_no
    1459                     ("Is your computer a laptop, or does the CD writer incorporate BurnProof technology?"))
    1460                 {
     1454                if (ask_me_yes_or_no("Is your computer a laptop, or does the CD writer incorporate BurnProof technology?")) {
    14611455                    bkpinfo->manual_cd_tray = TRUE;
    14621456                }
    14631457            }
    1464             if ((bkpinfo->compression_level =
    1465                  which_compression_level()) == -1) {
     1458            if ((bkpinfo->compression_level = which_compression_level()) == -1) {
    14661459                log_to_screen("User has chosen not to backup the PC");
    14671460                finish(1);
     
    14951488            mr_free(comment);
    14961489
    1497             bkpinfo->cdrw_speed = atoi(tmp1);   // if DVD then this shouldn't ever be used anyway :)
     1490            bkpinfo->cdrw_speed = atoi(tmp);    // if DVD then this shouldn't ever be used anyway :)
     1491            mr_free(tmp);
    14981492
    14991493            mr_asprintf(comment, "How much data (in Megabytes) will each %s store?", mds);
     
    20222016    }
    20232017    paranoid_free(sz_size);
    2024     paranoid_free(tmp1);
    2025     paranoid_free(prompt);
    20262018    return (0);
    20272019}
  • branches/2.2.10/mondo/src/common/libmondo-filelist.c

    r2404 r2405  
    15071507    char *sz_filelist;
    15081508    char *exclude_paths = NULL;
    1509     char *tmp;
    15101509    int i;
    15111510    FILE *fout;
     
    15161515    char *tmp2 = NULL;
    15171516
    1518     malloc_string(tmp);
    1519     malloc_string(g_skeleton_filelist);
    15201517    mr_asprintf(sz_datefile,MONDO_CACHE"/difflevel.%d" , 0);
    15211518    if (!include_paths && !userdef_filelist) {
     
    15871584        log_msg(2, "Excluding paths = '%s'", exclude_paths);
    15881585        log_msg(2, "Generating skeleton filelist so that we can track our progress");
    1589         sprintf(g_skeleton_filelist, "%s/tmpfs/skeleton.txt", bkpinfo->tmpdir);
     1586        mr_asprintf(g_skeleton_filelist, "%s/tmpfs/skeleton.txt", bkpinfo->tmpdir);
    15901587        make_hole_for_file(g_skeleton_filelist);
    15911588        log_msg(4, "g_skeleton_entries = %ld", g_skeleton_entries);
     
    16311628    paranoid_free(sz_filelist);
    16321629    log_msg(2, "Freeing variables");
    1633     paranoid_free(tmp);
    1634     paranoid_free(g_skeleton_filelist);
     1630    mr_free(g_skeleton_filelist);
    16351631    log_msg(2, "Exiting");
    16361632    return (0);
  • branches/2.2.10/mondo/src/common/libmondo-fork.c

    r2392 r2405  
    9595 * @return Exit code of @c mkisofs (0 is success, anything else indicates failure).
    9696 */
    97 int
    98 eval_call_to_make_ISO(char *basic_call, char *isofile, int cd_no, char *what_i_am_doing) {
     97int eval_call_to_make_ISO(char *basic_call, char *isofile, int cd_no, char *what_i_am_doing) {
    9998
    10099    /*@ int's  *** */
     
    106105    char *ultimate_call = NULL;
    107106    char *tmp = NULL;
    108     char *incoming, *old_stderr;
    109107       
    110108    char *cd_number_str = NULL;
     
    119117    assert(bkpinfo != NULL);
    120118    assert_string_is_neither_NULL_nor_zerolength(isofile);
    121     malloc_string(incoming);
    122     malloc_string(old_stderr);
    123 
    124     incoming[0] = '\0';
    125     old_stderr[0] = '\0';
    126119
    127120    if ((bkpinfo->netfs_user) && (strstr(bkpinfo->netfs_proto,"nfs"))) {
     
    187180    }
    188181    mr_free(command);
    189     paranoid_free(incoming);
    190     paranoid_free(old_stderr);
    191182    return (retval);
    192183}
  • branches/2.2.10/mondo/src/common/libmondo-raid.c

    r2357 r2405  
    591591{
    592592    FILE *fin;
    593     char *tmp;
    594593    char *label;
    595594    char *value;
     
    597596    int v;
    598597
    599     malloc_string(tmp);
    600     malloc_string(label);
    601     malloc_string(value);
    602598    assert(raidlist != NULL);
    603599    assert_string_is_neither_NULL_nor_zerolength(fname);
     
    606602        log_it("Raidtab is very small or non-existent. Ignoring it.");
    607603        raidlist->entries = 0;
    608         paranoid_free(tmp);
    609         paranoid_free(label);
    610         paranoid_free(value);
    611604        return (0);
    612605    }
    613606    if (!(fin = fopen(fname, "r"))) {
    614607        log_it("Cannot open raidtab");
    615         paranoid_free(tmp);
    616         paranoid_free(label);
    617         paranoid_free(value);
    618608        return (1);
    619609    }
    620610    items = 0;
    621611    log_it("Loading raidtab...");
     612    malloc_string(label);
     613    malloc_string(value);
    622614    get_next_raidtab_line(fin, label, value);
    623615    while (!feof(fin)) {
     
    631623            v++;
    632624            get_next_raidtab_line(fin, label, value);
    633             log_it(tmp);
    634625        }
    635626        raidlist->el[items].additional_vars.entries = v;
     
    651642    log_msg(1, "Raidtab loaded successfully.");
    652643    log_msg(1, "%d RAID devices in raidtab", items);
    653     paranoid_free(tmp);
    654644    paranoid_free(label);
    655645    paranoid_free(value);
  • branches/2.2.10/mondo/src/common/libmondo-stream.c

    r2383 r2405  
    13151315    while (ctrl_chr != BLK_START_AN_AFIO_OR_SLICE) {
    13161316        res =
    1317             read_header_block_from_stream(&temp_size, temp_fname,
    1318                                           &ctrl_chr);
     1317            read_header_block_from_stream(&temp_size, temp_fname, &ctrl_chr);
    13191318        if (ctrl_chr == BLK_START_AN_AFIO_OR_SLICE) {
    13201319            break;
     
    13261325    while (ctrl_chr != BLK_START_FILE) {
    13271326        res =
    1328             read_header_block_from_stream(&temp_size, temp_fname,
    1329                                           &ctrl_chr);
     1327            read_header_block_from_stream(&temp_size, temp_fname, &ctrl_chr);
    13301328        if (ctrl_chr == BLK_START_FILE) {
    13311329            break;
     
    13481346    }
    13491347    while (strcmp(pA, pB)) {
    1350         log_msg(6, "Skipping %s (it's not %s)", temp_fname,
    1351                 the_file_I_was_reading);
     1348        log_msg(6, "Skipping %s (it's not %s)", temp_fname, the_file_I_was_reading);
    13521349        for (size = temp_size; size > 0; size -= bytes_to_write) {
    13531350            bytes_to_write =
     
    13571354        }
    13581355        res =
    1359             read_header_block_from_stream(&temp_size, temp_fname,
    1360                                           &ctrl_chr);
     1356            read_header_block_from_stream(&temp_size, temp_fname, &ctrl_chr);
    13611357        if (ctrl_chr != BLK_STOP_FILE) {
    13621358            wrong_marker(BLK_STOP_FILE, ctrl_chr);
    13631359        }
    13641360        res =
    1365             read_header_block_from_stream(&temp_size, temp_fname,
    1366                                           &ctrl_chr);
     1361            read_header_block_from_stream(&temp_size, temp_fname, &ctrl_chr);
    13671362        if (ctrl_chr != BLK_STOP_AN_AFIO_OR_SLICE) {
    13681363            wrong_marker(BLK_STOP_AN_AFIO_OR_SLICE, ctrl_chr);
    13691364        }
    13701365        res =
    1371             read_header_block_from_stream(&temp_size, temp_fname,
    1372                                           &ctrl_chr);
     1366            read_header_block_from_stream(&temp_size, temp_fname, &ctrl_chr);
    13731367        if (ctrl_chr != BLK_START_AN_AFIO_OR_SLICE) {
    13741368            wrong_marker(BLK_START_AN_AFIO_OR_SLICE, ctrl_chr);
    13751369        }
    13761370        res =
    1377             read_header_block_from_stream(&temp_size, temp_fname,
    1378                                           &ctrl_chr);
     1371            read_header_block_from_stream(&temp_size, temp_fname, &ctrl_chr);
    13791372        if (ctrl_chr != BLK_START_FILE) {
    13801373            wrong_marker(BLK_START_FILE, ctrl_chr);
     
    13931386        }
    13941387    }
    1395     log_msg(2, "Reading %s (it matches %s)", temp_fname,
    1396             the_file_I_was_reading);
     1388    log_msg(2, "Reading %s (it matches %s)", temp_fname, the_file_I_was_reading);
    13971389    paranoid_free(temp_fname);
    13981390    paranoid_free(datablock);
  • branches/2.2.10/mondo/src/common/libmondo-string.c

    r2400 r2405  
    202202    long outval;
    203203    int i;
    204     char *tmp;
    205204    char *tmp1 = NULL;
    206205    char ch;
     
    208207    assert_string_is_neither_NULL_nor_zerolength(incoming);
    209208
    210     malloc_string(tmp);
    211209    if (!incoming[0]) {
    212         free(tmp);
    213210        return (0);
    214211    }
     
    216213        fatal_error("Please use integers only. No decimal points.");
    217214    }
    218     strcpy(tmp, incoming);
    219     i = (int) strlen(tmp);
    220     if (tmp[i - 1] == 'B' || tmp[i - 1] == 'b') {
    221         tmp[i - 1] = '\0';
    222     }
    223     for (i = 0; i < (int) strlen(tmp) && isdigit(tmp[i]); i++);
    224     ch = tmp[i];
    225     tmp[i] = '\0';
    226     outval = atol(tmp);
    227     paranoid_free(tmp);
     215
     216    mr_asprintf(tmp1, "%s", incoming);
     217    i = (int) strlen(tmp1);
     218    if (tmp1[i - 1] == 'B' || tmp1[i - 1] == 'b') {
     219        tmp1[i - 1] = '\0';
     220    }
     221    for (i = 0; i < (int) strlen(tmp1) && isdigit(tmp1[i]); i++);
     222    ch = tmp1[i];
     223    tmp1[i] = '\0';
     224    outval = atol(tmp1);
     225    paranoid_free(tmp1);
     226
    228227    if (ch == 'g' || ch == 'G') {
    229228        outval = outval * 1024;
  • branches/2.2.10/mondo/src/common/libmondo-tools.c

    r2383 r2405  
    393393    char *mondo_mkisofs_sz = NULL;
    394394    char *command = NULL;
    395     char *mtpt;
    396395    char *hostname = NULL;
    397396    char *ip_address = NULL;
     
    413412    }
    414413
    415     malloc_string(mtpt);
    416414    bkpinfo->optimal_set_size =
    417415        (IS_THIS_A_STREAMING_BACKUP(bkpinfo->backup_media_type) ? 16 : 16) *
     
    700698    }
    701699    g_backup_media_type = bkpinfo->backup_media_type;
    702     paranoid_free(mtpt);
    703700    return (retval);
    704701}
Note: See TracChangeset for help on using the changeset viewer.