Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.c > #42850

Re: dereferencing problem

From glen herrmannsfeldt <gah@ugcs.caltech.edu>
Newsgroups comp.lang.c
Subject Re: dereferencing problem
Date 2014-04-13 01:18 +0000
Organization Aioe.org NNTP Server
Message-ID <licol6$6uk$1@speranza.aioe.org> (permalink)
References <licdpj$k7j$1@dont-email.me> <licf4i$svt$1@dont-email.me> <qml2v.194935$h61.172017@fx06.iad>

Show all headers | View raw


Lew Pitcher <lew.pitcher@digitalfreehold.ca> wrote:
> On Saturday 12 April 2014 18:36, in comp.lang.c, "Bill Cunningham"

(snip)

>>     struct addrinfo *pa;
 
> Here, you define pa as an object that will contain a pointer to a struct
> addrinfo structure. 

(snip)
>>     pa->ai_family = AF_INET;
>     /
> Here, you try to stuff some data into an object that is 
> accessed through the pa pointer.

(snip)

> But, you never actually populate pa with an address. So all of these
> attempts to put data into objects pointed to by pa will result in errors,
> because pa *doesn't point at anything*.

If the OP is lucky, it segfaults.

If not, it stores it some place in memory where something else is
supposed to be, causing strange effects sometime later.

Not noticing the missing #include before, this is what I wrote
about previously.

-- glen

Back to comp.lang.c | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

dereferencing problem "Bill Cunningham" <nospam@nspam.invalid> - 2014-04-12 18:13 -0400
  Re: dereferencing problem "Bill Cunningham" <nospam@nspam.invalid> - 2014-04-12 18:36 -0400
    Re: dereferencing problem "Bill Cunningham" <nospam@nspam.invalid> - 2014-04-12 18:56 -0400
      Re: dereferencing problem glen herrmannsfeldt <gah@ugcs.caltech.edu> - 2014-04-12 23:16 +0000
        Re: dereferencing problem "Bill Cunningham" <nospam@nspam.invalid> - 2014-04-12 19:52 -0400
        Re: dereferencing problem "Bill Cunningham" <nospam@nspam.invalid> - 2014-04-12 19:57 -0400
          Re: dereferencing problem Barry Schwarz <schwarzb@dqel.com> - 2014-04-13 01:00 -0700
        Re: dereferencing problem Les Cargill <lcargill99@comcast.com> - 2014-04-14 01:10 -0500
          Re: dereferencing problem glen herrmannsfeldt <gah@ugcs.caltech.edu> - 2014-04-14 06:50 +0000
            Re: dereferencing problem Les Cargill <lcargill99@comcast.com> - 2014-04-14 07:42 -0500
            Re: dereferencing problem "Charles Richmond" <numerist@aquaporin4.com> - 2014-04-14 14:36 -0500
              Re: dereferencing problem glen herrmannsfeldt <gah@ugcs.caltech.edu> - 2014-04-14 20:10 +0000
    Re: dereferencing problem Barry Schwarz <schwarzb@dqel.com> - 2014-04-12 16:50 -0700
      Re: dereferencing problem "Bill Cunningham" <nospam@nspam.invalid> - 2014-04-12 20:12 -0400
        Re: dereferencing problem "Bill Cunningham" <nospam@nspam.invalid> - 2014-04-12 20:30 -0400
          Re: dereferencing problem Richard Damon <Richard@Damon-Family.org> - 2014-04-12 20:39 -0400
            Re: dereferencing problem "Bill Cunningham" <nospam@nspam.invalid> - 2014-04-12 21:01 -0400
              Re: dereferencing problem Ian Collins <ian-news@hotmail.com> - 2014-04-13 13:02 +1200
          Re: dereferencing problem Ian Collins <ian-news@hotmail.com> - 2014-04-13 12:53 +1200
          Re: dereferencing problem "Bill Cunningham" <nospam@nspam.invalid> - 2014-04-12 20:58 -0400
            Re: dereferencing problem Lew Pitcher <lew.pitcher@digitalfreehold.ca> - 2014-04-12 21:04 -0400
          Re: dereferencing problem Barry Schwarz <schwarzb@dqel.com> - 2014-04-13 01:13 -0700
            Re: dereferencing problem "Bill Cunningham" <nospam@nspam.invalid> - 2014-04-13 12:54 -0400
              Re: dereferencing problem Barry Schwarz <schwarzb@dqel.com> - 2014-04-13 14:14 -0700
        Re: dereferencing problem Barry Schwarz <schwarzb@dqel.com> - 2014-04-13 01:12 -0700
          Re: dereferencing problem "Bill Cunningham" <nospam@nspam.invalid> - 2014-04-13 12:57 -0400
            Re: dereferencing problem Barry Schwarz <schwarzb@dqel.com> - 2014-04-13 14:22 -0700
            Re: dereferencing problem glen herrmannsfeldt <gah@ugcs.caltech.edu> - 2014-04-13 22:18 +0000
    Re: dereferencing problem Lew Pitcher <lew.pitcher@digitalfreehold.ca> - 2014-04-12 21:02 -0400
      Re: dereferencing problem Ian Collins <ian-news@hotmail.com> - 2014-04-13 13:03 +1200
        Re: dereferencing problem Lew Pitcher <lew.pitcher@digitalfreehold.ca> - 2014-04-12 21:07 -0400
      Re: dereferencing problem glen herrmannsfeldt <gah@ugcs.caltech.edu> - 2014-04-13 01:18 +0000
        Re: dereferencing problem Ian Collins <ian-news@hotmail.com> - 2014-04-13 13:19 +1200
      Re: dereferencing problem "Bill Cunningham" <nospam@nspam.invalid> - 2014-04-12 21:25 -0400
        Re: dereferencing problem Ian Collins <ian-news@hotmail.com> - 2014-04-13 13:30 +1200
        Re: dereferencing problem Barry Schwarz <schwarzb@dqel.com> - 2014-04-13 01:18 -0700
          Re: dereferencing problem "Bill Cunningham" <nospam@nspam.invalid> - 2014-04-13 12:50 -0400
            Re: dereferencing problem Barry Schwarz <schwarzb@dqel.com> - 2014-04-13 14:24 -0700
              Re: dereferencing problem "Osmium" <r124c4u102@comcast.net> - 2014-04-13 18:48 -0500
              Re: dereferencing problem "Bill Cunningham" <nospam@nspam.invalid> - 2014-04-14 14:46 -0400
                Re: dereferencing problem "Bill Cunningham" <nospam@nspam.invalid> - 2014-04-14 15:58 -0400
                Re: dereferencing problem "Bill Cunningham" <nospam@nspam.invalid> - 2014-04-14 16:08 -0400
        Re: dereferencing problem Herbert Rosenau <os2guy@pc-rosenau.de> - 2014-05-03 14:19 +0200
          Re: dereferencing problem "Bill Cunningaham" <nospam@nspam.invalid> - 2014-05-03 11:29 -0400
            Re: dereferencing problem "Bill Cunningaham" <nospam@nspam.invalid> - 2014-05-03 11:42 -0400
          Re: dereferencing problem Richard <rgrdev_@gmail.com> - 2014-05-03 21:15 +0200
  Re: dereferencing problem Ian Collins <ian-news@hotmail.com> - 2014-04-13 11:15 +1200

csiph-web