Ignore:
Timestamp:
11/07/10 20:08:49 (14 years ago)
Author:
atzm
Message:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/pymigemo/pymigemo.c

    r38 r40  
    1111#include <stdbool.h> 
    1212#include <string.h> 
     13#include <stdlib.h> 
    1314#include <errno.h> 
    1415#include <sys/types.h> 
     
    171172{ 
    172173    PyObject      *result, *pyquery, *pyrestr; 
    173     char          *query, encoding[7]; 
     174    char          encoding[7], *query = NULL; 
    174175    unsigned char *regex; 
    175176 
     
    192193        } 
    193194 
    194         query = PyString_AS_STRING(q); 
     195        query = strdup(PyString_AS_STRING(q)); 
    195196        Py_DECREF(q); 
    196197    } 
    197198    else if (PyString_Check(pyquery)) { 
    198         query = PyString_AS_STRING(pyquery); 
     199        query = strdup(PyString_AS_STRING(pyquery)); 
    199200    } 
    200201    else { 
     
    207208 
    208209    regex = migemo_query(self->migemo_obj, query); 
     210    free(query); 
    209211    if (regex == NULL) { 
    210212        PyErr_SetString(PyExc_AssertionError, "migemo_query() failed"); 
Note: See TracChangeset for help on using the changeset viewer.