]> git.ipfire.org Git - thirdparty/tvheadend.git/commitdiff
dvr_rec: fix early access_destroy
authorLuis Alves <ljalvs@gmail.com>
Sun, 21 Oct 2018 23:20:42 +0000 (00:20 +0100)
committerJaroslav Kysela <perex@perex.cz>
Mon, 22 Oct 2018 06:50:08 +0000 (08:50 +0200)
src/dvr/dvr_rec.c

index bda175e42d68b6ce7eb23561b60aaf3db0c1f47b..02b405ee943d341cbc3acc7a503f56226c825687 100644 (file)
@@ -108,10 +108,10 @@ dvr_rec_subscribe(dvr_entry_t *de)
       return -EOVERFLOW;
     }
   }
-  access_destroy(aa);
 
   if(stat(de->de_config->dvr_storage, &st) || !S_ISDIR(st.st_mode)) {
     tvherror(LS_DVR, "the directory '%s' is not accessible", de->de_config->dvr_storage);
+    access_destroy(aa);
     return -EIO;
   }
 
@@ -129,6 +129,7 @@ dvr_rec_subscribe(dvr_entry_t *de)
                profile_get_name(pro), channel_get_name(de->de_channel));
       profile_chain_close(prch);
       free(prch);
+      access_destroy(aa);
       return -EINVAL;
     }
   }
@@ -141,6 +142,7 @@ dvr_rec_subscribe(dvr_entry_t *de)
              channel_get_name(de->de_channel), profile_get_name(pro));
     profile_chain_close(prch);
     free(prch);
+    access_destroy(aa);
     return -EINVAL;
   }
 
@@ -151,6 +153,7 @@ dvr_rec_subscribe(dvr_entry_t *de)
 
   if (de->de_config->dvr_preproc)
     dvr_spawn_cmd(de, de->de_config->dvr_preproc, NULL, 1);
+  access_destroy(aa);
   return 0;
 }