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>
This commit is contained in:
Ömer Fadıl USTA 2013-07-12 16:39:34 +03:00 committed by Brad King
parent 3b849a7ae9
commit 499531c64e
1 changed files with 1 additions and 1 deletions

View File

@ -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);