Fix commit d07cd37b993d3c9beded20323174633b806196b5
authorJeremy Allison <jra@samba.org>
Wed, 17 Feb 2010 17:24:34 +0000 (09:24 -0800)
committerJeremy Allison <jra@samba.org>
Wed, 17 Feb 2010 17:24:34 +0000 (09:24 -0800)
Which was:

    tsocket/bsd: fix bug #7115 FreeBSD includes the UDP header in FIONREAD

Metze, this has to have been wrong - you are throwing away the talloc_realloc
pointer returned. Also no error checking. Please review.

Thank goodness for gcc warnings :-).

Jeremy.

lib/tsocket/tsocket_bsd.c

index 9027bc97114f0b10286ede18b416f2ead919bc96..9d5a3290d977aa5c59f5065f5c5bddbb1edb4209 100644 (file)
@@ -887,8 +887,11 @@ static void tdgram_bsd_recvfrom_handler(void *private_data)
         * some systems too much bytes in tsocket_bsd_pending()
         * the return value includes some IP/UDP header bytes
         */
+       state->buf = talloc_realloc(state, state->buf, uint8_t, ret);
+       if (tevent_req_nomem(state->buf, req)) {
+               return;
+       }
        state->len = ret;
-       talloc_realloc(state, state->buf, uint8_t, ret);
 
        tevent_req_done(req);
 }