libobs/util: Fix warnings for about null usages

This commit is contained in:
jpark37 2021-03-31 05:12:44 -07:00 committed by Jim
parent cacc65f978
commit d5e265d7dd
2 changed files with 4 additions and 3 deletions

View File

@ -409,8 +409,10 @@ static inline void darray_move_item(const size_t element_size,
return;
temp = malloc(element_size);
if (!temp)
if (!temp) {
bcrash("darray_move_item: out of memory");
return;
}
p_from = darray_item(element_size, dst, from);
p_to = darray_item(element_size, dst, to);

View File

@ -229,8 +229,7 @@ static inline void dstr_ensure_capacity(struct dstr *dst, const size_t new_size)
static inline void dstr_copy_dstr(struct dstr *dst, const struct dstr *src)
{
if (dst->array)
dstr_free(dst);
dstr_free(dst);
if (src->len) {
dstr_ensure_capacity(dst, src->len + 1);