Author: sfrench
Date: 2007-04-28 16:56:35 +0000 (Sat, 28 Apr 2007)
New Revision: 22560

WebSVN: 
http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=22560

Log:
Clean up frees of realloc memory in mount.cifs (thanks to Alex for
reminding me how to use Valgrind).

Modified:
   branches/SAMBA_3_0/source/client/mount.cifs.c


Changeset:
Modified: branches/SAMBA_3_0/source/client/mount.cifs.c
===================================================================
--- branches/SAMBA_3_0/source/client/mount.cifs.c       2007-04-28 16:39:24 UTC 
(rev 22559)
+++ branches/SAMBA_3_0/source/client/mount.cifs.c       2007-04-28 16:56:35 UTC 
(rev 22560)
@@ -618,6 +618,7 @@
 nocopy:
                data = next_keyword;
        }
+       free(*optionsp);
        *optionsp = out;
        return 0;
 }
@@ -1233,14 +1234,11 @@
                                }
                        }
                default:
-                       
                        printf("mount error %d = %s\n",errno,strerror(errno));
                }
                printf("Refer to the mount.cifs(8) manual page (e.g.man 
mount.cifs)\n");
-               if(mountpassword) {
-                       memset(mountpassword,0,64);
-               }
-               return -1;
+               rc = -1;
+               goto mount_exit;
        } else {
                pmntfile = setmntent(MOUNTED, "a+");
                if(pmntfile) {
@@ -1283,6 +1281,8 @@
                    printf("could not update mount table\n");
                }
        }
+       rc = 0;
+mount_exit:
        if(mountpassword) {
                int len = strlen(mountpassword);
                memset(mountpassword,0,len);
@@ -1305,6 +1305,6 @@
        if(free_share_name) {
                free(share_name);
                }
-       return 0;
+       return rc;
 }
 

Reply via email to