]> git.tuebingen.mpg.de Git - paraslash.git/commitdiff
vss: Avoid potential double free of FEC parameters.
authorAndre Noll <maan@systemlinux.org>
Mon, 16 Aug 2010 07:29:59 +0000 (09:29 +0200)
committerAndre Noll <maan@systemlinux.org>
Sun, 31 Oct 2010 11:06:58 +0000 (12:06 +0100)
If an error occurs in initialize_fec_client() we free the FEC parameter
structure but do not invalidate it. It's both easier and safer to
free this struct just before allocating it.

vss.c

diff --git a/vss.c b/vss.c
index 3405d5a0600d27f359558be50f2cb1f853a0ab9e..96b2ba9eadcb71f2da13e5ccd6d00c08c328444f 100644 (file)
--- a/vss.c
+++ b/vss.c
@@ -282,11 +282,11 @@ static int initialize_fec_client(struct fec_client *fc, struct vss_task *vsst)
        rs = fc->fcp->slices_per_group - fc->fcp->data_slices_per_group;
        ret = num_slices(vsst->header_len, fc->mps - FEC_HEADER_SIZE, rs);
        if (ret < 0)
        rs = fc->fcp->slices_per_group - fc->fcp->data_slices_per_group;
        ret = num_slices(vsst->header_len, fc->mps - FEC_HEADER_SIZE, rs);
        if (ret < 0)
-               goto err;
+               return ret;
        hs = ret;
        ret = num_slices(mmd->afd.max_chunk_size, fc->mps - FEC_HEADER_SIZE, rs);
        if (ret < 0)
        hs = ret;
        ret = num_slices(mmd->afd.max_chunk_size, fc->mps - FEC_HEADER_SIZE, rs);
        if (ret < 0)
-               goto err;
+               return ret;
        ds = ret;
        k = hs + ds;
        if (k < fc->fcp->data_slices_per_group)
        ds = ret;
        k = hs + ds;
        if (k < fc->fcp->data_slices_per_group)
@@ -308,9 +308,6 @@ static int initialize_fec_client(struct fec_client *fc, struct vss_task *vsst)
        fc->stream_start = *now;
        fc->first_stream_chunk = mmd->current_chunk;
        return 1;
        fc->stream_start = *now;
        fc->first_stream_chunk = mmd->current_chunk;
        return 1;
-err:
-       fec_free(fc->parms);
-       return ret;
 }
 
 static void compute_group_size(struct vss_task *vsst, struct fec_group *g,
 }
 
 static void compute_group_size(struct vss_task *vsst, struct fec_group *g,