summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorSamuel Lidén Borell <samuel@slbdata.se>2011-08-04 20:42:58 +0200
committerSamuel Lidén Borell <samuel@slbdata.se>2011-08-04 20:42:58 +0200
commit48d92c54d7e0ea381f50f04aaf2f38cd4f33dce0 (patch)
tree0ac5c2b468c87979db4ac06624effaf6d2a7dfd9
parent4e9f07588e177b7c2786c29e73afb9d2ca880f5e (diff)
downloadfribid-48d92c54d7e0ea381f50f04aaf2f38cd4f33dce0.tar.gz
fribid-48d92c54d7e0ea381f50f04aaf2f38cd4f33dce0.tar.bz2
fribid-48d92c54d7e0ea381f50f04aaf2f38cd4f33dce0.zip
Fix memory leak in rasprintf_append
-rw-r--r--client/misc.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/client/misc.c b/client/misc.c
index c13c4e3..bbc14de 100644
--- a/client/misc.c
+++ b/client/misc.c
@@ -64,11 +64,11 @@ char *rasprintf_append(char *str, const char *format, ...) {
size_t oldlen = strlen(str);
size_t taillen = strlen(tail);
- str = realloc(str, oldlen+taillen+1);
- if (!str) goto error;
- memcpy(&str[oldlen], tail, taillen+1);
+ char *merged = realloc(str, oldlen+taillen+1);
+ if (!merged) goto error;
+ memcpy(&merged[oldlen], tail, taillen+1);
free(tail);
- return str;
+ return merged;
error:
free(tail);