diff options
author | Samuel Thibault <samuel.thibault@ens-lyon.org> | 2013-11-10 00:21:08 +0100 |
---|---|---|
committer | Samuel Thibault <samuel.thibault@ens-lyon.org> | 2013-11-10 00:21:08 +0100 |
commit | 52e9ef870d362b5fd0a44653beb1a4c094e4d615 (patch) | |
tree | 7235802381eea2ebcd5e82c87bc2fc9f50014cb1 /user | |
parent | 99a32b7776b16c94c45ce484dc09d8f6f52d6b70 (diff) |
Fix memleak
Diffstat (limited to 'user')
-rw-r--r-- | user/tlecarrour/porting_guide_for_dummies.mdwn | 4 |
1 files changed, 3 insertions, 1 deletions
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; |