Ignore:
Timestamp:
Nov 15, 2005, 12:01:12 AM (14 years ago)
Author:
bcornec
Message:

memory management going on (libmondo-verify.c, libmondo-devices.c, libmondo-string.c, libmondo-stream.c)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/mondo/mondo/common/libmondo-verify.c

    r120 r122  
    608608    char *orig_cksum;
    609609    char *tmp;
    610     char *slice_fnam;
     610    char *slice_fnam = (char *)&res;
    611611
    612612    /*@ pointers ******************************************************** */
     
    616616    long long slice_siz;
    617617
    618     malloc_string(slice_fnam);
    619618    assert(bkpinfo != NULL);
    620619    assert_string_is_neither_NULL_nor_zerolength(biggie_fname);
     
    627626    }
    628627    asprintf(&test_file, "%s/temporary-%s", bkpinfo->tmpdir, p);
    629     /* BERLIOS: useless
    630        asprintf(&tmp,
    631        "Temporarily copying biggiefile %s's slices from tape to '%s'",
    632        p, test_file);
    633        log_it(tmp);
    634        paranoid_free(tmp);
    635      */
     628    asprintf(&tmp,
     629    "Temporarily copying biggiefile %s's slices from tape to '%s'",
     630    p, test_file);
     631    log_it(tmp);
     632    paranoid_free(tmp);
    636633    for (res =
    637634         read_header_block_from_stream(&slice_siz, slice_fnam, &ctrl_chr);
     
    645642        res = read_file_from_stream_to_file(bkpinfo, test_file, slice_siz);
    646643        unlink(test_file);
     644        paranoid_free(slice_fnam);
     645        slice_fnam = (char *)&res;
    647646        res =
    648647            read_header_block_from_stream(&slice_siz, slice_fnam,
     
    654653        current_slice_number++;
    655654        retval += res;
     655        paranoid_free(slice_fnam);
     656        slice_fnam = (char *)&res;
    656657    }
    657658    paranoid_free(test_file);
     
    705706    /*@ buffers ***************************************************** */
    706707    char *tmp;
    707     char *fname;
     708    char *fname = (char *)&res;             /* Should NOT be NULL */
    708709    char *curr_xattr_list_fname;
    709710    char *curr_acl_list_fname;
     
    713714
    714715    assert(bkpinfo != NULL);
    715     malloc_string(fname);
    716716
    717717    asprintf(&curr_xattr_list_fname, XATTR_BIGGLST_FNAME_RAW_SZ,
     
    725725                       "Please wait. This may take a couple of hours.", "",
    726726                       total_afioballs);
    727     res = read_header_block_from_stream(&size, fname, &ctrl_chr);
     727    res = read_header_block_from_stream(&size, NULL, &ctrl_chr);
    728728    if (ctrl_chr != BLK_START_AFIOBALLS) {
    729729        iamhere("YOU SHOULD NOT GET HERE");
     
    731731        if (ctrl_chr == BLK_START_EXTENDED_ATTRIBUTES) {
    732732            res =
    733                 read_EXAT_files_from_tape(bkpinfo, &size, fname, &ctrl_chr,
     733                read_EXAT_files_from_tape(bkpinfo, &size, NULL, &ctrl_chr,
    734734                                          curr_xattr_list_fname,
    735735                                          curr_acl_list_fname);
     
    744744    for (res = read_header_block_from_stream(&size, fname, &ctrl_chr);
    745745         ctrl_chr != BLK_STOP_AFIOBALLS;
    746          res = read_header_block_from_stream(&size, fname, &ctrl_chr)) {
     746         res =
     747         read_header_block_from_stream(&size, fname, &ctrl_chr)) {
    747748        asprintf(&curr_xattr_list_fname, XATTR_LIST_FNAME_RAW_SZ,
    748749                 bkpinfo->tmpdir, current_afioball_number);
     
    751752        if (ctrl_chr == BLK_START_EXTENDED_ATTRIBUTES) {
    752753            iamhere("Reading EXAT files from tape");
     754            paranoid_free(fname);
     755            fname = (char *)&res;
    753756            res =
    754757                read_EXAT_files_from_tape(bkpinfo, &size, fname, &ctrl_chr,
     
    777780        current_afioball_number++;
    778781        g_current_progress++;
     782        paranoid_free(fname);
     783        fname = (char *)&res;
    779784        res = read_header_block_from_stream(&size, fname, &ctrl_chr);
    780785        if (ctrl_chr != BLK_STOP_AN_AFIO_OR_SLICE) {
    781786            wrong_marker(BLK_STOP_AN_AFIO_OR_SLICE, ctrl_chr);
    782787        }
     788        paranoid_free(fname);
     789        fname = (char *)&res;
    783790    }
    784791    log_msg(1, "All done with afioballs");
     
    810817
    811818    /*@ buffers ******************************************************** */
    812     char *orig_fname, *logical_fname;
     819    char *orig_fname = (char *)&ctrl_chr;   /* Should NOT be NULL */
     820    char *logical_fname;
    813821    char *comment;
    814822    char *curr_xattr_list_fname;
     
    821829
    822830    assert(bkpinfo != NULL);
    823     malloc_string(orig_fname);
    824831
    825832    asprintf(&curr_xattr_list_fname, XATTR_BIGGLST_FNAME_RAW_SZ,
     
    829836    asprintf(&comment, "Verifying all bigfiles.");
    830837    log_to_screen(comment);
    831     /*
    832        asprintf(&tmp, "%s/biggielist.txt", bkpinfo->tmpdir);
    833        noof_biggiefiles = count_lines_in_file (tmp); // pointless
    834        paranoid_free(tmp);
    835      */
    836838    res = read_header_block_from_stream(&size, orig_fname, &ctrl_chr);
    837839    if (ctrl_chr != BLK_START_BIGGIEFILES) {
    838840        if (ctrl_chr == BLK_START_EXTENDED_ATTRIBUTES) {
    839841            iamhere("Grabbing the EXAT biggiefiles");
     842            paranoid_free(orig_fname);
     843            orig_fname = (char *)&ctrl_chr;
    840844            res =
    841845                read_EXAT_files_from_tape(bkpinfo, &size, orig_fname,
     
    846850    paranoid_free(curr_xattr_list_fname);
    847851    paranoid_free(curr_acl_list_fname);
     852    paranoid_free(orig_fname);
     853    orig_fname = (char *)&ctrl_chr;
    848854
    849855    if (ctrl_chr != BLK_START_BIGGIEFILES) {
     
    884890        current_biggiefile_number++;
    885891        g_current_progress++;
     892        paranoid_free(orig_fname);
     893        orig_fname = (char *)&ctrl_chr;
    886894    }
    887895    close_progress_form();
    888     paranoid_free(orig_fname);
    889896    return (retval);
    890897}
Note: See TracChangeset for help on using the changeset viewer.