Changeset 11603:57399ad8c343 in orange


Ignore:
Timestamp:
06/21/13 11:30:10 (10 months ago)
Author:
Ales Erjavec <ales.erjavec@…>
Branch:
default
Message:

Fixed two memory leaks.

Location:
source/orange
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • source/orange/cls_orange.cpp

    r11065 r11603  
    10721072      *name ^= 32; 
    10731073      } 
    1074     return PyString_FromString(name); 
     1074 
     1075    PyObject * orangename = PyString_FromString(name); 
     1076    free(name); 
     1077 
     1078    return orangename; 
     1079 
    10751080  PyCATCH 
    10761081} 
  • source/orange/lib_kernel.cpp

    r11001 r11603  
    21812181    for(pe = pi; *pe && *pe != sep; pe++); 
    21822182    const int plen = pe-pi; 
    2183     char *npath = strncpy(new char[plen+flen+2], pi, pe-pi); 
     2183    char *npath = new char[plen + flen + 2]; 
     2184    strncpy(npath, pi, pe - pi); 
    21842185    if (!plen || (pi[plen] != pathsep)) { 
    21852186      npath[plen] = pathsep; 
     
    21902191    } 
    21912192    PyObject *res = loadDataFromFileNoSearch(type, npath, argstuple, keywords, generatorOnly); 
     2193    delete[] npath; 
     2194 
    21922195    PyErr_Clear(); 
    21932196    if (res) { 
Note: See TracChangeset for help on using the changeset viewer.