Fixed some issues/warnings found by clang-analyzer.

This commit is contained in:
Juan RP 2013-06-20 11:25:43 +02:00
parent 42c0766c00
commit 52fc384e4e
5 changed files with 9 additions and 13 deletions

View File

@ -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 */

View File

@ -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.

View File

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

View File

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

View File

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