소스 검색

libobs/callback: Set default return values to 0/NULL

These functions created stack variables but never actually initialized
them.  If the calldata variable is invalid, the return values will be
the uninitialized stack value.
jp9000 10 년 전
부모
커밋
d1f225e2e8
1개의 변경된 파일2개의 추가작업 그리고 2개의 파일을 삭제
  1. 2 2
      libobs/callback/calldata.h

+ 2 - 2
libobs/callback/calldata.h

@@ -131,7 +131,7 @@ static inline bool calldata_bool(const calldata_t *data, const char *name)
 
 static inline void *calldata_ptr(const calldata_t *data, const char *name)
 {
-	void *val;
+	void *val = NULL;
 	calldata_get_ptr(data, name, &val);
 	return val;
 }
@@ -139,7 +139,7 @@ static inline void *calldata_ptr(const calldata_t *data, const char *name)
 static inline const char *calldata_string(const calldata_t *data,
 		const char *name)
 {
-	const char *val;
+	const char *val = NULL;
 	calldata_get_string(data, name, &val);
 	return val;
 }