Ticket #2036: redundant.diff

File redundant.diff, 6.8 KB (added by pavlinux, 15 years ago)

redundant checks

  • lib/vfs/mc-vfs/ftpfs.c

    diff --git a/lib/vfs/mc-vfs/ftpfs.c b/lib/vfs/mc-vfs/ftpfs.c
    index fc6f3d5..1ccee01 100644
    a b ftpfs_load_no_proxy_list (void) 
    597597            np->domain = g_strdup (s); 
    598598            np->next   = NULL; 
    599599            if (no_proxy) 
    600                 current->next = np; 
     600                current->next = np; /* FIXME: potential null derefence */ 
    601601            else 
    602602                no_proxy = np; 
    603603            current = np; 
  • lib/vfs/mc-vfs/samba/lib/charset.c

    diff --git a/lib/vfs/mc-vfs/samba/lib/charset.c b/lib/vfs/mc-vfs/samba/lib/charset.c
    index 58be253..d021c69 100644
    a b clean_and_exit: 
    315315 
    316316  if(fp != NULL) 
    317317    fclose(fp); 
    318   if(cp_p) 
    319     free((char *)cp_p); 
     318 
     319  free((char *)cp_p); 
    320320  return NULL; 
    321321} 
    322322 
  • lib/vfs/mc-vfs/samba/lib/util.c

    diff --git a/lib/vfs/mc-vfs/samba/lib/util.c b/lib/vfs/mc-vfs/samba/lib/util.c
    index 98df37a..bec32ec 100644
    a b void *Realloc(void *p,size_t size) 
    16421642  void *ret=NULL; 
    16431643 
    16441644  if (size == 0) { 
    1645     if (p) free(p); 
     1645    free(p); 
    16461646    DEBUG(5,("Realloc asked for 0 bytes\n")); 
    16471647    return NULL; 
    16481648  } 
    16491649 
    1650   if (!p) 
     1650  if (!p) 
    16511651    ret = (void *)malloc(size); 
    16521652  else 
    16531653    ret = (void *)realloc(p,size); 
  • lib/vfs/mc-vfs/samba/lib/util_str.c

    diff --git a/lib/vfs/mc-vfs/samba/lib/util_str.c b/lib/vfs/mc-vfs/samba/lib/util_str.c
    index 74b5303..64611e2 100644
    a b void string_free(char **s) 
    980980  if (!s || !(*s)) return; 
    981981  if (*s == null_string) 
    982982    *s = NULL; 
    983   if (*s) free(*s); 
     983  free(*s); 
    984984  *s = NULL; 
    985985} 
    986986 
  • lib/vfs/mc-vfs/samba/libsmb/clientgen.c

    diff --git a/lib/vfs/mc-vfs/samba/libsmb/clientgen.c b/lib/vfs/mc-vfs/samba/libsmb/clientgen.c
    index 0dd0710..0a16a14 100644
    a b int cli_RNetShareEnum(struct cli_state *cli, void (*fn)(const char *, uint32, co 
    591591              DEBUG(4,("NetShareEnum failed\n")); 
    592592    } 
    593593   
    594   if (rparam) 
    595     free(rparam); 
    596   if (rdata) 
    597     free(rdata); 
     594  free(rparam); 
     595  free(rdata); 
    598596 
    599597  return count; 
    600598} 
    BOOL cli_NetServerEnum(struct cli_state *cli, char *workgroup, uint32 stype, 
    664662                } 
    665663        } 
    666664   
    667         if (rparam) 
    668665      free(rparam); 
    669         if (rdata) 
    670666      free(rdata); 
    671667         
    672668        return(count > 0); 
    BOOL cli_qfileinfo(struct cli_state *cli, int fnum, 
    18841880                *ino = IVAL(rdata, 64); 
    18851881        } 
    18861882 
    1887         if (rdata) free(rdata); 
    1888         if (rparam) free(rparam); 
     1883        free(rdata); 
     1884        free(rparam); 
    18891885        return True; 
    18901886} 
    18911887 
    int cli_list(struct cli_state *cli,const char *Mask,uint16 attribute, 
    21412137 
    21422138                total_received += ff_searchcount; 
    21432139 
    2144                 if (rdata) free(rdata); rdata = NULL; 
    2145                 if (rparam) free(rparam); rparam = NULL; 
     2140                free(rdata); rdata = NULL; 
     2141                free(rparam); rparam = NULL; 
    21462142                 
    21472143                DEBUG(3,("received %d entries (eos=%d resume=%d)\n", 
    21482144                         ff_searchcount,ff_eos,ff_resume_key)); 
    int cli_list(struct cli_state *cli,const char *Mask,uint16 attribute, 
    21562152        } 
    21572153 
    21582154        /* free up the dirlist buffer */ 
    2159         if (dirlist) free(dirlist); 
     2155        free(dirlist); 
    21602156        return(total_received); 
    21612157} 
    21622158 
    shutdown a client structure 
    24032399****************************************************************************/ 
    24042400void cli_shutdown(struct cli_state *cli) 
    24052401{ 
    2406         if (cli->outbuf) 
    2407         { 
    2408                 free(cli->outbuf); 
    2409         } 
    2410         if (cli->inbuf) 
    2411         { 
    2412                 free(cli->inbuf); 
    2413         } 
     2402        free(cli->outbuf); 
     2403        free(cli->inbuf); 
    24142404#ifdef WITH_SSL 
    24152405    if (cli->fd != -1) 
    24162406      sslutil_disconnect(cli->fd); 
  • lib/vfs/mc-vfs/samba/libsmb/nmblib.c

    diff --git a/lib/vfs/mc-vfs/samba/libsmb/nmblib.c b/lib/vfs/mc-vfs/samba/libsmb/nmblib.c
    index 85a01aa..e9d7265 100644
    a b struct packet_struct *copy_packet(struct packet_struct *packet) 
    620620  ******************************************************************/ 
    621621static void free_nmb_packet(struct nmb_packet *nmb) 
    622622 
    623   if (nmb->answers) free(nmb->answers); 
    624   if (nmb->nsrecs) free(nmb->nsrecs); 
    625   if (nmb->additional) free(nmb->additional); 
     623  free(nmb->answers); 
     624  free(nmb->nsrecs); 
     625  free(nmb->additional); 
    626626} 
    627627 
    628628/******************************************************************* 
  • lib/vfs/mc-vfs/samba/param/loadparm.c

    diff --git a/lib/vfs/mc-vfs/samba/param/loadparm.c b/lib/vfs/mc-vfs/samba/param/loadparm.c
    index 7e4ad2e..bc955e5 100644
    a b free the dynamically allocated parts of a service struct 
    13191319static void free_service(service *pservice) 
    13201320{ 
    13211321  int i; 
     1322 
    13221323  if (!pservice) 
    13231324     return; 
    13241325 
    static void free_service(service *pservice) 
    13261327    DEBUG(5,("free_service: Freeing service %s\n", pservice->szService)); 
    13271328 
    13281329  string_free(&pservice->szService); 
    1329   if (pservice->copymap) 
    1330   { 
    1331     free(pservice->copymap); 
    1332     pservice->copymap = NULL; 
    1333   } 
     1330 
     1331  free(pservice->copymap); 
     1332  pservice->copymap = NULL; 
    13341333  
    13351334  for (i=0;parm_table[i].label;i++) 
    13361335    if ((parm_table[i].type == P_STRING || 
    initialise a copymap 
    18491848static void init_copymap(service *pservice) 
    18501849{ 
    18511850  size_t i; 
    1852   if (pservice->copymap) free(pservice->copymap); 
     1851 
     1852  free(pservice->copymap); 
     1853 
    18531854  pservice->copymap = (BOOL *)malloc(sizeof(BOOL)*NUMPARAMETERS); 
    18541855  if (!pservice->copymap) 
    18551856    DEBUG(0,("Couldn't allocate copymap!! (size %d)\n",(int)NUMPARAMETERS)); 
  • lib/vfs/mc-vfs/tar.c

    diff --git a/lib/vfs/mc-vfs/tar.c b/lib/vfs/mc-vfs/tar.c
    index 817194c..6d22208 100644
    a b tar_read_header (struct vfs_class *me, struct vfs_s_super *archive, 
    644644            while (tar_get_next_record (archive, tard)->ext_hdr. 
    645645                   isextended); 
    646646            inode->data_offset = current_tar_position; 
     647            /* FIXME: potential null derefence 'inode' */ 
    647648        } 
    648649        return STATUS_SUCCESS; 
    649650    } 
  • src/man2hlp.c

    diff --git a/src/man2hlp.c b/src/man2hlp.c
    index aa95df6..c578c9f 100644
    a b main (int argc, char **argv) 
    838838        fprintf (f_out, "\n"); 
    839839 
    840840        free (cnode->node); 
    841         if (cnode->lname) 
    842841            free (cnode->lname); 
    843842        if (cnode != &nodes) 
    844843            free (cnode); 
  • src/mountlist.c

    diff --git a/src/mountlist.c b/src/mountlist.c
    index 86dd361..1b48243 100644
    a b static void free_mount_entry (struct mount_entry *me) 
    155155{ 
    156156    if (!me) 
    157157        return; 
    158     if (me->me_devname) 
     158 
    159159        free (me->me_devname); 
    160     if (me->me_mountdir) 
    161160        free (me->me_mountdir); 
    162     if (me->me_type) 
    163161        free (me->me_type); 
    164162    free (me); 
    165163} 
  • src/viewer/display.c

    diff --git a/src/viewer/display.c b/src/viewer/display.c
    index d027cc2..b6e06dd 100644
    a b mcview_display_status (mcview_t * view) 
    129129    const screen_dimen width = view->status_area.width; 
    130130    const screen_dimen height = view->status_area.height; 
    131131    const char *file_label; 
    132     screen_dimen file_label_width, i = 0; 
     132    screen_dimen file_label_width; 
    133133 
    134134    if (height < 1) 
    135135        return;