diff options
author | Ömer Fadıl USTA <omerusta@gmail.com> | 2013-07-12 13:39:34 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2013-07-15 14:20:00 (GMT) |
commit | 499531c64e0cd3a6834616af576d612e8678e4d9 (patch) | |
tree | 1596108467238f067251dc4be9e93addc83fbe46 | |
parent | 3b849a7ae9051372cbf35c869a367d911e12491e (diff) | |
download | CMake-499531c64e0cd3a6834616af576d612e8678e4d9.zip CMake-499531c64e0cd3a6834616af576d612e8678e4d9.tar.gz CMake-499531c64e0cd3a6834616af576d612e8678e4d9.tar.bz2 |
libarchive: Fix free() order to avoid accessing freed memory
The archive_string_conv type sc variable already freed via free(sc) on
the other hand in second line we are tyring to free its subset via
free(sc->from_charset) this will cause a problem because we couldn't
reach sc after first release.
Reviewed-by: Igor Murzov <e-mail@date.by>
-rw-r--r-- | Utilities/cmlibarchive/libarchive/archive_string.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/Utilities/cmlibarchive/libarchive/archive_string.c b/Utilities/cmlibarchive/libarchive/archive_string.c index cbfad2c..370a5fc 100644 --- a/Utilities/cmlibarchive/libarchive/archive_string.c +++ b/Utilities/cmlibarchive/libarchive/archive_string.c @@ -1248,8 +1248,8 @@ create_sconv_object(const char *fc, const char *tc, } sc->to_charset = strdup(tc); if (sc->to_charset == NULL) { - free(sc); free(sc->from_charset); + free(sc); return (NULL); } archive_string_init(&sc->utftmp); |