summaryrefslogtreecommitdiffstats
path: root/paste.c
diff options
context:
space:
mode:
authornicm <nicm>2014-02-17 23:07:03 +0000
committernicm <nicm>2014-02-17 23:07:03 +0000
commit6daf06b1ad61f67e9f7780d787451b9b5f82dd43 (patch)
treeadcac8b7975434a335487147e09920c26593039e /paste.c
parent69b7c496accc2a646e5e2dee7870bea1194a6641 (diff)
Fix memory leaks with paste_replace, based on changes from J Raynor.
Diffstat (limited to 'paste.c')
-rw-r--r--paste.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/paste.c b/paste.c
index 2e89a5ef..946935a3 100644
--- a/paste.c
+++ b/paste.c
@@ -131,8 +131,10 @@ paste_replace(struct paste_stack *ps, u_int idx, char *data, size_t size)
{
struct paste_buffer *pb;
- if (size == 0)
+ if (size == 0) {
+ free(data);
return (0);
+ }
if (idx >= ARRAY_LENGTH(ps))
return (-1);