Ignore:
Timestamp:
Jun 29, 2009, 7:19:14 PM (11 years ago)
Author:
Bruno Cornec
Message:

r3144@localhost: bruno | 2009-06-26 12:18:08 +0200

  • Remove mr_string.c|.h useless and in de=uplication with mr_str.c|.h
  • Solve with valgrind's help some memroy leak (harmless mostly)
  • Solve a seg fault at end, when unallocating a bkpinfo member after the strcuture disallocation !
  • after mr_strtok, memory ssociated with the token needs to be free
  • Adds a new function free_newt_stuff to free newt related allocated memory
  • Do not exit if mr_free is unsuccessful, and only warn when debug > 8
File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/2.2.9/mondo/src/mondoarchive/mondoarchive.c

    r2211 r2241  
    7676    tmp = get_uname_m();
    7777    log_msg(0, "running on %s architecture", tmp);
    78     free(tmp);
     78    mr_free(tmp);
    7979    log_msg(0,
    8080            "-----------------------------------------------------------");
     
    138138void distro_specific_kludges_at_end_of_mondoarchive(void)
    139139{
    140 //  char tmp[500];
    141140    log_msg(2, "Restarting magicdev if necessary");
    142141    sync();
     
    166165int main(int argc, char *argv[])
    167166{
    168     char *tmp;
     167    char *tmp = NULL;
    169168    char *tmp1 = NULL;
    170169    int res, retval;
     
    196195    retval = 0;
    197196    diffs = 0;
    198     malloc_string(tmp);
    199197    malloc_libmondo_global_strings();
    200198
     
    244242    if (argc == 4 && !strcmp(argv[1], "setfattr")) {
    245243        g_loglevel = 10;
    246 //      chdir("/tmp");
    247244        g_text_mode = TRUE;
    248245        setup_newt_stuff();
     
    254251        g_text_mode = TRUE;
    255252        setup_newt_stuff();
     253        malloc_string(tmp);
    256254        turn_wildcard_chars_into_literal_chars(tmp, argv[2]);
    257255        printf("in=%s; out=%s\n", argv[2], tmp);
     256        paranoid_free(tmp);
    258257        finish(1);
    259258    }
     
    273272    if (argc == 4 && !strcmp(argv[1], "setfacl")) {
    274273        g_loglevel = 10;
    275 //      chdir("/tmp");
    276274        g_text_mode = TRUE;
    277275        setup_newt_stuff();
     
    283281        g_text_mode = TRUE;
    284282        setup_newt_stuff();
     283        malloc_string(tmp);
    285284        if (find_cdrw_device(tmp)) {
    286285            printf("Failed to find CDR-RW drive\n");
     
    294293            printf("CD-ROM is at %s\n", tmp);
    295294        }
     295        paranoid_free(tmp);
    296296        finish(0);
    297297    }
     
    301301        g_text_mode = TRUE;
    302302        setup_newt_stuff();
     303        malloc_string(tmp);
    303304        if (find_dvd_device(tmp, atoi(argv[2]))) {
    304305            printf("Failed to find DVD drive\n");
     
    306307            printf("DVD is at %s\n", tmp);
    307308        }
     309        paranoid_free(tmp);
    308310        finish(0);
    309311    }
     
    373375        res = verify_data();
    374376        if (res < 0) {
    375             sprintf(tmp, "%d difference%c found.", -res,
     377            mr_asprintf(&tmp, "%d difference%c found.", -res,
    376378                    (-res != 1) ? 's' : ' ');
    377379            mr_asprintf(&say_at_end, tmp);
    378380            log_to_screen(tmp);
     381            mr_free(tmp);
    379382            res = 0;
    380383        }
     
    412415        paranoid_free(say_at_end);
    413416    }
    414     sprintf(tmp, "umount %s/tmpfs", bkpinfo->tmpdir);
     417    mr_asprintf(&tmp, "umount %s/tmpfs", bkpinfo->tmpdir);
    415418    run_program_and_log_output(tmp, TRUE);
     419    mr_free(tmp);
    416420    if (bkpinfo->backup_media_type == usb) {
    417421        log_msg(1, "Unmounting USB device.");
    418         sprintf(tmp, "umount %s1", bkpinfo->media_device);
     422        mr_asprintf(&tmp, "umount %s1", bkpinfo->media_device);
    419423        run_program_and_log_output(tmp, TRUE);
     424        mr_free(tmp);
    420425    }
    421426
Note: See TracChangeset for help on using the changeset viewer.