~ubuntu-branches/debian/sid/flickcurl/sid

« back to all changes in this revision

Viewing changes to src/stat.c

  • Committer: Package Import Robot
  • Author(s): Kumar Appaiah
  • Date: 2013-05-20 21:15:09 UTC
  • mfrom: (1.4.1) (15.1.1 experimental)
  • Revision ID: package-import@ubuntu.com-20130520211509-e701o5dlwa04aqiw
Tags: 1.24-1
New upstream release

Show diffs side-by-side

added added

removed removed

Lines of Context:
129
129
    s = (flickcurl_stat*)calloc(sizeof(flickcurl_stat), 1);
130
130
    
131
131
    for(attr = node->properties; attr; attr = attr->next) {
 
132
      size_t attr_len = strlen((const char*)attr->children->content);
132
133
      const char *attr_name = (const char*)attr->name;
133
134
      char *attr_value;
134
135
 
135
 
      attr_value = (char*)malloc(strlen((const char*)attr->children->content)+1);
136
 
      strcpy(attr_value, (const char*)attr->children->content);
 
136
      attr_value = (char*)malloc(attr_len + 1);
 
137
      memcpy(attr_value, attr->children->content, attr_len + 1);
137
138
      
138
139
      if(!strcmp(attr_name, "views")) {
139
140
        s->views = atoi(attr_value);
150
151
        s->url = attr_value;
151
152
      else if(!strcmp(attr_name, "searchterms"))
152
153
        s->searchterms = attr_value;
 
154
      else
 
155
        free(attr_value);
153
156
    } /* end attributes */
154
157
 
155
158