The Samba-Bugzilla – Attachment 4194 Details for
Bug 6398
[PATCH] Memory leaks in source4/client/smbumount.c
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Fix for 2 possible memory leaks in source4/client/smbumount.c
0002-source4-client-smbumount.c-canonicalize-fixed-memory.patch (text/plain), 1.25 KB, created by
Slava Semushin
on 2009-05-23 07:08:05 UTC
(
hide
)
Description:
Fix for 2 possible memory leaks in source4/client/smbumount.c
Filename:
MIME Type:
Creator:
Slava Semushin
Created:
2009-05-23 07:08:05 UTC
Size:
1.25 KB
patch
obsolete
>From 61d094543cf4722f45cb1bbc59c6d5cf371fefb3 Mon Sep 17 00:00:00 2001 >From: Slava Semushin <php-coder@altlinux.ru> >Date: Sat, 23 May 2009 18:56:51 +0700 >Subject: [PATCH 2/2] source4/client/smbumount.c(canonicalize): fixed memory leaks. > >Fixed memory leak when path too long or path is NULL (in this case I >just check path to NULL before alloc memory). > >Found by cppcheck: >[source4/client/smbumount.c:83]: (all) Memory leak: canonical >[source4/client/smbumount.c:87]: (error) Memory leak: canonical >--- > source4/client/smbumount.c | 10 ++++++---- > 1 files changed, 6 insertions(+), 4 deletions(-) > >diff --git a/source4/client/smbumount.c b/source4/client/smbumount.c >index 420b8ac..7100629 100644 >--- a/source4/client/smbumount.c >+++ b/source4/client/smbumount.c >@@ -72,18 +72,20 @@ umount_ok(const char *mount_point) > static char * > canonicalize (char *path) > { >- char *canonical = malloc (PATH_MAX + 1); >+ char *canonical = NULL; > >+ if (path == NULL) >+ return NULL; >+ >+ canonical = malloc (PATH_MAX + 1); > if (!canonical) { > fprintf(stderr, "Error! Not enough memory!\n"); > return NULL; > } > >- if (path == NULL) >- return NULL; >- > if (strlen(path) > PATH_MAX) { > fprintf(stderr, "Mount point string too long\n"); >+ free(canonical); > return NULL; > } > >-- >1.6.3.1 >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Actions:
View
Attachments on
bug 6398
:
4193
| 4194