diff --git a/src/include/addr_parsing.c b/src/include/addr_parsing.c index 62ff46adc468f..b676fd85e2b33 100644 --- a/src/include/addr_parsing.c +++ b/src/include/addr_parsing.c @@ -24,6 +24,7 @@ int safe_cat(char **pstr, int *plen, int pos, const char *str2) { int len2 = strlen(str2); + //printf("safe_cat '%s' max %d pos %d '%s' len %d\n", *pstr, *plen, pos, str2, len2); while (*plen < pos + len2 + 1) { *plen += BUF_SIZE; *pstr = (char *)realloc(*pstr, (size_t)*plen); @@ -32,9 +33,11 @@ int safe_cat(char **pstr, int *plen, int pos, const char *str2) printf("Out of memory\n"); exit(1); } + //printf("safe_cat '%s' max %d pos %d '%s' len %d\n", *pstr, *plen, pos, str2, len2); } strncpy((*pstr)+pos, str2, len2); + (*pstr)[pos+len2] = '\0'; return pos + len2; } diff --git a/src/mount/mount.ceph.c b/src/mount/mount.ceph.c index d45935be89355..37017f16c6712 100755 --- a/src/mount/mount.ceph.c +++ b/src/mount/mount.ceph.c @@ -63,7 +63,6 @@ static char *mount_resolve_src(const char *orig_str) } src = resolve_addrs(buf); - free(buf); if (!src) return NULL; @@ -71,6 +70,7 @@ static char *mount_resolve_src(const char *orig_str) pos = safe_cat(&src, &len, len, ":"); safe_cat(&src, &len, pos, mount_path); + free(buf); return src; }