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

« back to all changes in this revision

Viewing changes to src/comments.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:
121
121
    comment_object = (flickcurl_comment*)calloc(sizeof(flickcurl_comment), 1);
122
122
    
123
123
    for(attr = node->properties; attr; attr = attr->next) {
 
124
      size_t attr_len = strlen((const char*)attr->children->content);
124
125
      const char *attr_name = (const char*)attr->name;
125
126
      char *attr_value;
126
127
      
127
 
      attr_value = (char*)malloc(strlen((const char*)attr->children->content)+1);
128
 
      strcpy(attr_value, (const char*)attr->children->content);
 
128
      attr_value = (char*)malloc(attr_len + 1);
 
129
      memcpy(attr_value, attr->children->content, attr_len + 1);
129
130
      
130
131
      if(!strcmp(attr_name, "id"))
131
132
        comment_object->id = attr_value;
145
146
    /* Walk children nodes for comment text */
146
147
    for(chnode = node->children; chnode; chnode = chnode->next) {
147
148
      if(chnode->type == XML_TEXT_NODE) {
148
 
        comment_object->text = (char*)malloc(strlen((const char*)chnode->content)+1);
149
 
        strcpy(comment_object->text, (const char*)chnode->content);
 
149
        size_t len = strlen((const char*)chnode->content);
 
150
        comment_object->text = (char*)malloc(len + 1);
 
151
        memcpy(comment_object->text, chnode->content, len +1);
150
152
        break;
151
153
      }
152
154
    }