]> arthur.barton.de Git - netatalk.git/commitdiff
Realloc, not malloc
authorFrank Lahm <franklahm@googlemail.com>
Mon, 20 Dec 2010 12:30:52 +0000 (13:30 +0100)
committerFrank Lahm <franklahm@googlemail.com>
Mon, 20 Dec 2010 12:30:52 +0000 (13:30 +0100)
libatalk/adouble/ad_write.c

index 06a9e3c5c405e2298caaf05887c6577acc4a3edd..dc6ee839862b7740f046638f32a5d14c831d8fcb 100644 (file)
@@ -85,9 +85,8 @@ ssize_t ad_write(struct adouble *ad, uint32_t eid, off_t off, int end, const cha
                 ad->ad_rlen = off + cc;
         } else { /* AD_VERSION_EA */
             if ((off + buflen) > ad->ad_resforkbufsize) {
-                free(ad->ad_resforkbuf);
                 size_t roundup = (((off + buflen) / RFORK_EA_ALLOCSIZE) + 1) * RFORK_EA_ALLOCSIZE;
-                if ((ad->ad_resforkbuf = malloc(roundup)) == NULL)
+                if ((ad->ad_resforkbuf = realloc(roundup)) == NULL)
                     return -1;
                 ad->ad_resforkbufsize = roundup;
             }