diff --git a/lib/archive.c b/lib/archive.c index b9ee88fd..4a7a9237 100644 --- a/lib/archive.c +++ b/lib/archive.c @@ -140,6 +140,7 @@ xbps_archive_get_dictionary(struct archive *ar, struct archive_entry *entry) if (uncomp_buf == NULL) { /* Error while decompressing */ free(buf); + free(uncomp_buf); return NULL; } else { /* We have the uncompressed data */ diff --git a/lib/package_unpack.c b/lib/package_unpack.c index 7673e987..81645cda 100644 --- a/lib/package_unpack.c +++ b/lib/package_unpack.c @@ -559,7 +559,6 @@ unpack_archive(struct xbps_handle *xhp, pkgver, strerror(rv)); goto out; } - metafile = true; } /* * If there was any error extracting files from archive, error out. diff --git a/lib/portableproplib/prop_array.c b/lib/portableproplib/prop_array.c index 565418b1..8df01669 100644 --- a/lib/portableproplib/prop_array.c +++ b/lib/portableproplib/prop_array.c @@ -107,6 +107,8 @@ _prop_array_free(prop_stack_t stack, prop_object_t *obj) return (_PROP_OBJECT_FREE_DONE); } + if (pa->pa_array == NULL) + return _PROP_OBJECT_FREE_DONE; po = pa->pa_array[pa->pa_count - 1]; _PROP_ASSERT(po != NULL); diff --git a/lib/portableproplib/prop_dictionary.c b/lib/portableproplib/prop_dictionary.c index 8b329fbb..8baba9cb 100644 --- a/lib/portableproplib/prop_dictionary.c +++ b/lib/portableproplib/prop_dictionary.c @@ -359,6 +359,8 @@ _prop_dictionary_free(prop_stack_t stack, prop_object_t *obj) return (_PROP_OBJECT_FREE_DONE); } + if (pd->pd_array == NULL) + return _PROP_OBJECT_FREE_DONE; po = pd->pd_array[pd->pd_count - 1].pde_objref; _PROP_ASSERT(po != NULL); diff --git a/lib/portableproplib/prop_object.c b/lib/portableproplib/prop_object.c index ae2105a0..008fbc5a 100644 --- a/lib/portableproplib/prop_object.c +++ b/lib/portableproplib/prop_object.c @@ -254,8 +254,10 @@ _prop_object_externalize_footer(struct _prop_object_externalize_context *ctx) { if (_prop_object_externalize_end_tag(ctx, "plist") == false || - _prop_object_externalize_append_char(ctx, '\0') == false) + _prop_object_externalize_append_char(ctx, '\0') == false) { + free(ctx->poec_buf); return (false); + } return (true); } @@ -816,7 +818,7 @@ _prop_object_externalize_write_file(const char *fname, const char *xml, size_t len, bool do_compress) { gzFile gzf = NULL; - char tname[PATH_MAX], *otname; + char tname[PATH_MAX]; int fd; int save_errno; mode_t myumask; @@ -832,19 +834,10 @@ _prop_object_externalize_write_file(const char *fname, const char *xml, */ _prop_object_externalize_file_dirname(fname, tname); -#ifdef HAVE_STRLCAT if (strlcat(tname, "/.plistXXXXXX", sizeof(tname)) >= sizeof(tname)) { errno = ENAMETOOLONG; return (false); } -#else - otname = strncat(tname, "/.plistXXXXXX", sizeof(tname) - strlen(tname) - 1); - - if (sizeof(*otname) >= sizeof(tname)) { - errno = ENAMETOOLONG; - return (false); - } -#endif if ((fd = mkstemp(tname)) == -1) return (false); @@ -1192,7 +1185,6 @@ prop_object_equals_with_error(prop_object_t obj1, prop_object_t obj2, &stored_pointer1, &stored_pointer2)) return true; po1 = obj1; - po2 = obj2; goto continue_subtree; } _PROP_ASSERT(ret == _PROP_OBJECT_EQUALS_RECURSE);