diff options
author | Simo Sorce <idra@samba.org> | 2008-01-16 12:06:34 -0500 |
---|---|---|
committer | Simo Sorce <idra@samba.org> | 2008-01-16 12:06:34 -0500 |
commit | 04b2a9e80a8c35e37faf2e0a8e54efb9a084f2e3 (patch) | |
tree | 9cb49347eab028a5f65a4f2aa4c61de42cff08fd /source3/libads/ads_struct.c | |
parent | 94fdd59f1c2a41b8e737aa8ca8939e9bf2b59a77 (diff) | |
parent | 8c41366a98ea96224adc2c108b940075431944fd (diff) | |
download | samba-04b2a9e80a8c35e37faf2e0a8e54efb9a084f2e3.tar.gz samba-04b2a9e80a8c35e37faf2e0a8e54efb9a084f2e3.tar.bz2 samba-04b2a9e80a8c35e37faf2e0a8e54efb9a084f2e3.zip |
Merge branch 'v3-2-test' of ssh://git.samba.org/data/git/samba into v3-2-simo
(This used to be commit 05c22a55a4c052c682a2f2afdb0696504195d18c)
Diffstat (limited to 'source3/libads/ads_struct.c')
-rw-r--r-- | source3/libads/ads_struct.c | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/source3/libads/ads_struct.c b/source3/libads/ads_struct.c index 041878916e..44bcdf76ea 100644 --- a/source3/libads/ads_struct.c +++ b/source3/libads/ads_struct.c @@ -32,18 +32,23 @@ char *ads_build_path(const char *realm, const char *sep, const char *field, int r = SMB_STRDUP(realm); - if (!r || !*r) + if (!r || !*r) { return r; + } - for (p=r; *p; p++) - if (strchr(sep, *p)) + for (p=r; *p; p++) { + if (strchr(sep, *p)) { numbits++; + } + } len = (numbits+1)*(strlen(field)+1) + strlen(r) + 1; ret = (char *)SMB_MALLOC(len); - if (!ret) + if (!ret) { + free(r); return NULL; + } strlcpy(ret,field, len); p=strtok(r,sep); @@ -57,7 +62,8 @@ char *ads_build_path(const char *realm, const char *sep, const char *field, int else asprintf(&s, "%s,%s%s", ret, field, p); free(ret); - ret = s; + ret = SMB_STRDUP(s); + free(s); } } |