Skip to content
This repository was archived by the owner on Aug 5, 2022. It is now read-only.

Commit 07ed87d

Browse files
committed
Initialize variables
This patch fixes the following -Werror=maybe-uninitialized errors: psm_diags.c:294:10: error: 'dst_p' may be used uninitialized in this function [-Werror=maybe-uninitialized] if (dst_p) psmi_free(dst_p); ^ In file included from psm_user.h:54:0, from psm_diags.c:35: psm_utils.h:156:23: error: 'src_p' may be used uninitialized in this function [-Werror=maybe-uninitialized] #define psmi_free(sz) psmi_free_internal(sz) ^ psm_diags.c:290:11: note: 'src_p' was declared here void *src_p, *dst_p; ^ If posix_memalign fails to return a value different than zero, the pointers are never initialized.
1 parent 67c0807 commit 07ed87d

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

psm_diags.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -287,7 +287,7 @@ memcpy_check_size (memcpy_fn_t fn, int *p, int *f, size_t n)
287287
return -1;
288288
}
289289
else {
290-
void *src_p, *dst_p;
290+
void *src_p = NULL, *dst_p = NULL;
291291
if (posix_memalign(&src_p, 64, size) != 0 ||
292292
posix_memalign(&dst_p, 64, size) != 0) {
293293
if (src_p) psmi_free(src_p);

0 commit comments

Comments
 (0)