Skip to content

Commit

Permalink
conf: clean up interface names on config file read failure
Browse files Browse the repository at this point in the history
==12076==ERROR: LeakSanitizer: detected memory leaks

Direct leak of 7 byte(s) in 1 object(s) allocated from:
    #0 0x499bba in __interceptor_malloc (/home/ferry/vcs/nbs/nbsolsrd/olsrd+0x499bba)
    ninuxorg#1 0x5784cd in get_string_token src/cfgparser/oscan.lex:92
    ninuxorg#2 0x578ef7 in yylex src/cfgparser/oscan.lex:185
    ninuxorg#3 0x5699c4 in yyparse src/cfgparser/oparse.c:1686
    ninuxorg#4 0x55e322 in olsrd_parse_cnf src/cfgparser/olsrd_conf.c:158
    ninuxorg#5 0x4edf56 in olsrmain_load_config src/main.c:281
    ninuxorg#6 0x4ee5e6 in main src/main.c:386
    #7 0x7fd24079757f in __libc_start_main (/lib64/libc.so.6+0x2057f)

SUMMARY: AddressSanitizer: 7 byte(s) leaked in 1 allocation(s).

Signed-off-by: Ferry Huberts <[email protected]>
  • Loading branch information
fhuberts committed Oct 18, 2015
1 parent 9722e7b commit 7f7133b
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/cfgparser/olsrd_conf.c
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,13 @@ olsrd_parse_cnf(const char *filename)
rc = yyparse();
fclose(yyin);
if (rc != 0) {
/* Interface names that were parsed successfully are not cleaned up. */
struct olsr_if* b = olsr_cnf->interfaces;
while (b) {
free(b->name);
b->name = NULL;
b = b->next;
}
return -1;
}

Expand Down

0 comments on commit 7f7133b

Please sign in to comment.