Changeset 552da22 for lib/http_client.c


Ignore:
Timestamp:
2023-04-01T20:29:42Z (20 months ago)
Author:
GitHub <noreply@…>
Branches:
master
Children:
10425b2
Parents:
a4ac9c4
git-author:
David Cantrell <dcantrell@…> (01-04-23 20:29:42)
git-committer:
GitHub <noreply@…> (01-04-23 20:29:42)
Message:

Use g_memdup2() with glib versions >= 2.68.0 (#168)

  • Use g_memdup2() with glib versions >= 2.68.0

g_memdup() was deprecated in glib 2.68.0. The new function is
g_memdup2(). Still support building with older versions of glib via
macros.

Signed-off-by: David Cantrell <dcantrell@…>

  • Fall back to g_memdup when g_memdup2 is not available, rather than defining custom macro

Signed-off-by: David Cantrell <dcantrell@…>
Co-authored-by: Jelmer Vernooij <jelmer@…>

File:
1 edited

Legend:

Unmodified
Added
Removed
  • lib/http_client.c

    ra4ac9c4 r552da22  
    372372        if (chunk != req->cbuf) {
    373373                req->cblen = eos - chunk;
    374                 s = g_memdup(chunk, req->cblen + 1);
     374                s = g_memdup2(chunk, req->cblen + 1);
    375375                g_free(req->cbuf);
    376376                req->cbuf = s;
     
    462462        /* Separately allocated space for headers and body. */
    463463        req->sblen = req->body_size = req->reply_headers + req->bytes_read - req->reply_body;
    464         req->sbuf = req->reply_body = g_memdup(req->reply_body, req->body_size + 1);
     464        req->sbuf = req->reply_body = g_memdup2(req->reply_body, req->body_size + 1);
    465465        req->reply_headers = g_realloc(req->reply_headers, end1 - req->reply_headers + 1);
    466466
     
    680680
    681681        if (req->reply_body - req->sbuf >= 512) {
    682                 char *new = g_memdup(req->reply_body, req->body_size + 1);
     682                char *new = g_memdup2(req->reply_body, req->body_size + 1);
    683683                g_free(req->sbuf);
    684684                req->reply_body = req->sbuf = new;
Note: See TracChangeset for help on using the changeset viewer.