From 52e9ef870d362b5fd0a44653beb1a4c094e4d615 Mon Sep 17 00:00:00 2001 From: Samuel Thibault Date: Sun, 10 Nov 2013 00:21:08 +0100 Subject: Fix memleak --- user/tlecarrour/porting_guide_for_dummies.mdwn | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'user/tlecarrour') diff --git a/user/tlecarrour/porting_guide_for_dummies.mdwn b/user/tlecarrour/porting_guide_for_dummies.mdwn index 64f0ba0d..cdab3508 100644 --- a/user/tlecarrour/porting_guide_for_dummies.mdwn +++ b/user/tlecarrour/porting_guide_for_dummies.mdwn @@ -217,8 +217,10 @@ The code comes from [[https://buildsecurityin.us-cert.gov/bsi/articles/knowledge if (buff == NULL) return NULL; int nchars = readlink(filename, buff, size); - if (nchars < 0) + if (nchars < 0) { + free(buff); return NULL; + } if (nchars < size) { buff[nchars] = '\0'; return buff; -- cgit v1.2.3