Fix memory leak.
authorfredrik <fredrik@959494ce-11ee-0310-bf91-de5d638817bd>
Thu, 26 Oct 2006 00:15:40 +0000 (00:15 +0000)
committerfredrik <fredrik@959494ce-11ee-0310-bf91-de5d638817bd>
Thu, 26 Oct 2006 00:15:40 +0000 (00:15 +0000)
git-svn-id: svn+ssh://svn.dolda2000.com/srv/svn/repos/src/doldaconnect@715 959494ce-11ee-0310-bf91-de5d638817bd

daemon/fnet-dc.c

index 772306c..198672f 100644 (file)
@@ -1167,10 +1167,11 @@ static void cmd_search(struct socket *sk, struct fnetnode *fn, char *cmd, char *
                if(!dotth && !strncmp(p, "TTH:", 4))
                {
                    dotth = 1;
-                   if((buf = base32decode(p + 4, &buflen)) == NULL)
-                       goto out;
-                   if(buflen != 24)
+                   if(((buf = base32decode(p + 4, &buflen)) == NULL) || (buflen != 24))
+                   {
+                       free(buf);
                        goto out;
+                   }
                    memcpy(hashtth, buf, 24);
                    free(buf);
                } else {