Ignore:
Timestamp:
11/01/12 00:23:21 (11 years ago)
Author:
nit
Message:

[titan] fix memleak, add if NULL, add return code

File:
1 edited

Legend:

Unmodified
Added
Removed
  • titan/plugins/tithek/kinox.h

    r18152 r18398  
    4343}
    4444
    45 void kinox_search(struct skin* grid, struct skin* listbox, struct skin* countlabel, struct skin* load, char* link, char* title)
     45int kinox_search(struct skin* grid, struct skin* listbox, struct skin* countlabel, struct skin* load, char* link, char* title)
    4646{
     47        int ret = 1;
     48
     49        if(listbox == NULL || listbox->select == NULL || listbox->select->handle == NULL)
     50                return ret;
     51
    4752        char* search = textinputhist("Search", " ", "searchhist");
    48                
    4953        if(search != NULL)
    5054        {
     
    151155                                menu = ostrcat("/tmp/tithek/kinox.search.list", NULL, 0, 0);
    152156                                writesys(menu, line, 0);
     157                                free(((struct tithek*)listbox->select->handle)->link);
    153158                                ((struct tithek*)listbox->select->handle)->link = menu;
     159                                ret = 0;
    154160                        }
    155161
     
    159165        }
    160166        free(search), search = NULL;
     167        return ret;
    161168}
    162169
    163 void kinox_hoster(struct skin* grid, struct skin* listbox, struct skin* countlabel, struct skin* load, char* link, char* title)
     170int kinox_hoster(struct skin* grid, struct skin* listbox, struct skin* countlabel, struct skin* load, char* link, char* title)
    164171{
    165172        debug(99, "link: %s", link);
     173        int ret = 1;
    166174        char* ip = NULL, *pos = NULL, *path = NULL, *tmpstr = NULL, *tmpstr1 = NULL, *tmpstr2 = NULL, *line = NULL, *url = NULL, *pathnew = NULL;               
     175
     176        if(listbox == NULL || listbox->select == NULL || listbox->select->handle == NULL)
     177                return ret;
     178
    167179        ip = string_replace("http://", "", (char*)link, 0);
    168180
     
    378390                tmpstr = ostrcat("/tmp/tithek/kinox.hoster.list", NULL, 0, 0);
    379391                writesys(tmpstr, line, 0);
     392                free(((struct tithek*)listbox->select->handle)->link);
    380393                ((struct tithek*)listbox->select->handle)->link = tmpstr;
    381         }       
     394                ret = 0;
     395        }
     396
     397        return ret;
    382398}
    383399
    384 void kinox_hoster_series(struct skin* grid, struct skin* listbox, struct skin* countlabel, struct skin* load, char* link, char* title)
     400int kinox_hoster_series(struct skin* grid, struct skin* listbox, struct skin* countlabel, struct skin* load, char* link, char* title)
    385401{
    386402        debug(99, "link: %s", link);
     403        int ret = 1;
    387404        char* ip = NULL, *pathnew = NULL, *seriesid = NULL, *searchname = NULL, *url = NULL, *session = NULL, *episode = NULL, *pos = NULL, *path = NULL, *tmpstr = NULL, *tmpstr1 = NULL, *tmpstr2 = NULL, *line = NULL;               
     405
     406        if(listbox == NULL || listbox->select == NULL || listbox->select->handle == NULL)
     407                return ret;
    388408
    389409        int count0 = 0;
     
    570590                tmpstr = ostrcat("/tmp/tithek/kinox.hoster.series.list", NULL, 0, 0);
    571591                writesys(tmpstr, line, 0);
     592                free(((struct tithek*)listbox->select->handle)->link);
    572593                ((struct tithek*)listbox->select->handle)->link = tmpstr;
    573         }       
     594                ret = 0;
     595        }
     596
     597        return ret;
    574598}
    575599
Note: See TracChangeset for help on using the changeset viewer.