[PATCH 2/2] Only memcpy() if source and destination are different



---
 src/gvnc.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/src/gvnc.c b/src/gvnc.c
index c413c91..8921a76 100644
--- a/src/gvnc.c
+++ b/src/gvnc.c
@@ -1017,7 +1017,9 @@ gboolean gvnc_set_pixel_format(struct gvnc *gvnc,
 
 	gvnc_write(gvnc, pad, 3);
 	gvnc_flush(gvnc);
-	memcpy(&gvnc->fmt, fmt, sizeof(*fmt));
+
+	if (&gvnc->fmt != fmt)
+		memcpy(&gvnc->fmt, fmt, sizeof(*fmt));
 
 	return !gvnc_has_error(gvnc);
 }
-- 
1.6.3.3


--=-wnnUhOqSSrhRZZtkvKeH--



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]