Commits

Christophe Grenier  committed 5a0e2bb

PhotoRec: close PDF file before renaming it

  • Participants
  • Parent commits 66d99f2

Comments (0)

Files changed (1)

File src/file_pdf.c

     fclose(handle);
     return ;
   }
+  fclose(handle);
   /* Skip spaces after /Title */
   for(i=0; i<bsize && buffer[i]==' '; i++);
   if(i==bsize)
   {
     /* Too much spaces */
     free(buffer);
-    fclose(handle);
     return ;
   }
   if(buffer[i]=='<')
   else
   {
     free(buffer);
-    fclose(handle);
     return ;
   }
   /* Try to avoid some double-extensions */
     j-=5;
   file_rename(old_filename, title, j, 0, NULL, 1);
   free(buffer);
-  fclose(handle);
 }
 
 static int header_check_pdf(const unsigned char *buffer, const unsigned int buffer_size, const unsigned int safe_header_only, const file_recovery_t *file_recovery, file_recovery_t *file_recovery_new)