diff options
author | bapt <bapt@FreeBSD.org> | 2016-04-20 21:23:42 +0000 |
---|---|---|
committer | bapt <bapt@FreeBSD.org> | 2016-04-20 21:23:42 +0000 |
commit | f3bbb3cf24ede85da9181aa9b767c804ff8789fe (patch) | |
tree | 64d0143ce540906f7f2d7f9c8ab13522eb58f3c5 /usr.bin/localedef | |
parent | c6fadd21159e75b733e0d9255c93d1d052bee153 (diff) | |
download | FreeBSD-src-f3bbb3cf24ede85da9181aa9b767c804ff8789fe.zip FreeBSD-src-f3bbb3cf24ede85da9181aa9b767c804ff8789fe.tar.gz |
Plug memory leaks
Reported by: Coverity
CID= 1338535, 1338536, 1338542, 1338569, 1338570
Diffstat (limited to 'usr.bin/localedef')
-rw-r--r-- | usr.bin/localedef/collate.c | 3 | ||||
-rw-r--r-- | usr.bin/localedef/time.c | 2 |
2 files changed, 5 insertions, 0 deletions
diff --git a/usr.bin/localedef/collate.c b/usr.bin/localedef/collate.c index 91c9ec6..32c583c 100644 --- a/usr.bin/localedef/collate.c +++ b/usr.bin/localedef/collate.c @@ -502,6 +502,7 @@ define_collsym(char *name) * This should never happen because we are only called * for undefined symbols. */ + free(sym); INTERR; return; } @@ -538,6 +539,7 @@ get_collundef(char *name) if (((ud = calloc(sizeof (*ud), 1)) == NULL) || ((ud->name = strdup(name)) == NULL)) { fprintf(stderr,"out of memory"); + free(ud); return (NULL); } for (i = 0; i < NUM_WT; i++) { @@ -812,6 +814,7 @@ define_collelem(char *name, wchar_t *wcs) if ((RB_FIND(elem_by_symbol, &elem_by_symbol, e) != NULL) || (RB_FIND(elem_by_expand, &elem_by_expand, e) != NULL)) { fprintf(stderr, "duplicate collating element definition"); + free(e); return; } RB_INSERT(elem_by_symbol, &elem_by_symbol, e); diff --git a/usr.bin/localedef/time.c b/usr.bin/localedef/time.c index a3ace79..6daf7ac 100644 --- a/usr.bin/localedef/time.c +++ b/usr.bin/localedef/time.c @@ -87,6 +87,7 @@ add_time_str(wchar_t *wcs) case T_ERA_T_FMT: case T_ERA_D_T_FMT: /* Silently ignore it. */ + free(str); break; default: free(str); @@ -139,6 +140,7 @@ add_time_list(wchar_t *wcs) tm.pm = str; } else { fprintf(stderr,"too many list elements"); + free(str); } break; case T_ALT_DIGITS: |