From 499531c64e0cd3a6834616af576d612e8678e4d9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=96mer=20Fad=C4=B1l=20USTA?= Date: Fri, 12 Jul 2013 16:39:34 +0300 Subject: [PATCH] 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 --- Utilities/cmlibarchive/libarchive/archive_string.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Utilities/cmlibarchive/libarchive/archive_string.c b/Utilities/cmlibarchive/libarchive/archive_string.c index cbfad2c5b..370a5fc6b 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);