~louis/ubuntu/trusty/clamav/lp799623_fix_logrotate

« back to all changes in this revision

Viewing changes to libclamav/text.c

  • Committer: Package Import Robot
  • Author(s): Scott Kitterman
  • Date: 2014-02-01 11:06:17 UTC
  • mfrom: (0.35.37 sid)
  • Revision ID: package-import@ubuntu.com-20140201110617-33h2xxk09dep0ui4
Tags: 0.98.1+dfsg-1ubuntu1
* Merge from Debian unstable.  Remaining changes:
  - Drop build-dep on electric-fence (in Universe)
  - Add apparmor profiles for clamd and freshclam along with maintainer
    script changes
  - Add autopkgtest

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/*
2
 
 *  Copyright (C) 2007-2008 Sourcefire, Inc.
 
2
 *  Copyright (C) 2007-2013 Sourcefire, Inc.
3
3
 *
4
4
 *  Authors: Nigel Horne
5
5
 *
146
146
                }
147
147
 
148
148
                if(last == NULL) {
 
149
            cli_errmsg("textCopy: Unable to allocate memory to clone object\n");
149
150
                        if(first)
150
151
                                textDestroy(first);
151
152
                        return NULL;
225
226
        else {
226
227
                text *anotherText = messageToText(aMessage);
227
228
 
228
 
                if(aText)
229
 
                        return textMove(aText, anotherText);
 
229
                if(aText) {
 
230
                        text *newHead = textMove(aText, anotherText);
 
231
                        free(anotherText);
 
232
                        return newHead;
 
233
                }
230
234
                return anotherText;
231
235
        }
232
236
}
247
251
                        return NULL;
248
252
                }
249
253
                t_head = (text *)cli_malloc(sizeof(text));
250
 
                if(t_head == NULL)
 
254
                if(t_head == NULL) {
 
255
            cli_errmsg("textMove: Unable to allocate memory for head\n");
251
256
                        return NULL;
 
257
        }
252
258
                t_head->t_line = t->t_line;
253
259
                t_head->t_next = t->t_next;
254
260
                t->t_line = NULL;
269
275
         * empty, the rest is moved by a simple pointer reassignment
270
276
         */
271
277
        t_head->t_next = (text *)cli_malloc(sizeof(text));
272
 
        if(t_head->t_next == NULL)
 
278
        if(t_head->t_next == NULL) {
 
279
        cli_errmsg("textMove: Unable to allocate memory for head->next\n");
273
280
                return NULL;
 
281
    }
274
282
        t_head = t_head->t_next;
275
283
 
276
284
        assert(t_head != NULL);