Ignore:
Timestamp:
Jun 29, 2009, 7:19:14 PM (15 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/common/newt-specific.c

    r2230 r2241  
    368368    }
    369369
     370/* Free memory allocated for newt */
     371void free_newt_stuff() {
     372
     373int i;
     374
     375for (i = 0; i < g_noof_log_lines; i++) {
     376    mr_free(err_log_lines[i]);
     377}
     378mr_free(err_log_lines);
     379}
     380
    370381
    371382
     
    405416        printf("Execution run ended; result=%d\n", signal);
    406417        printf("Type 'less %s' to see the output log\n", MONDO_LOGFILE);
    407         if (strstr(bkpinfo->tmpdir ,"mondo.tmp.") != NULL) {
    408             mr_asprintf(&command, "rm -Rf %s %s", bkpinfo->tmpdir, bkpinfo->scratchdir);
    409             system(command);
    410             paranoid_free(command);
    411         }
     418        if (bkpinfo->tmpdir) {
     419            log_msg(8,"tempdir is %s",bkpinfo->tmpdir);
     420            if (strstr(bkpinfo->tmpdir ,"mondo.tmp.") != NULL) {
     421                log_msg(8,"erasing tempdir");
     422                mr_asprintf(&command, "rm -Rf %s", bkpinfo->tmpdir);
     423                system(command);
     424                paranoid_free(command);
     425            }
     426        }
     427        if (bkpinfo->scratchdir) {
     428            log_msg(8,"scratchdir is %s", bkpinfo->scratchdir);
     429            if (strstr(bkpinfo->scratchdir ,"mondo.scratch.") != NULL) {
     430                log_msg(8,"erasing scratchdir");
     431                mr_asprintf(&command, "rm -Rf %s", bkpinfo->scratchdir);
     432                system(command);
     433                paranoid_free(command);
     434            }
     435        }
     436        /* Free all allocated strings in bkpinfo */
     437        mr_free(bkpinfo->nfs_user);
     438
     439        /* Then free the structure */
    412440        paranoid_free(bkpinfo);
    413441        free_libmondo_global_strings();
     442        free_newt_stuff();
    414443        exit(signal);
    415444    }
Note: See TracChangeset for help on using the changeset viewer.