Browse Source

libobs/util: Fix warnings for about null usages

jpark37 4 years ago
parent
commit
d5e265d7dd
2 changed files with 4 additions and 3 deletions
  1. 3 1
      libobs/util/darray.h
  2. 1 2
      libobs/util/dstr.h

+ 3 - 1
libobs/util/darray.h

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

+ 1 - 2
libobs/util/dstr.h

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