Date: Wed, 20 Apr 2016 21:23:43 +0000 (UTC) From: Baptiste Daroussin <bapt@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r298378 - head/usr.bin/localedef Message-ID: <201604202123.u3KLNhhJ093658@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: bapt Date: Wed Apr 20 21:23:42 2016 New Revision: 298378 URL: https://svnweb.freebsd.org/changeset/base/298378 Log: Plug memory leaks Reported by: Coverity CID= 1338535, 1338536, 1338542, 1338569, 1338570 Modified: head/usr.bin/localedef/collate.c head/usr.bin/localedef/time.c Modified: head/usr.bin/localedef/collate.c ============================================================================== --- head/usr.bin/localedef/collate.c Wed Apr 20 21:21:47 2016 (r298377) +++ head/usr.bin/localedef/collate.c Wed Apr 20 21:23:42 2016 (r298378) @@ -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); Modified: head/usr.bin/localedef/time.c ============================================================================== --- head/usr.bin/localedef/time.c Wed Apr 20 21:21:47 2016 (r298377) +++ head/usr.bin/localedef/time.c Wed Apr 20 21:23:42 2016 (r298378) @@ -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:
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201604202123.u3KLNhhJ093658>