Comments (2)
Hey,
exactly -- we have a pointer (vfs_dir_t *dir
) and want the size of what it is pointing to. Hence the sizeof *dir
.
me@home ~/tmp$ cat test.c
#include <stdio.h>
int main(unsigned int argc, char **argv) {
unsigned char *c;
printf("sizeof *c: %d\n", sizeof *c);
printf("sizeof c: %d\n", sizeof c);
}
me@home ~/tmp$ gcc -o test test.c
me@home ~/tmp$ ./test
sizeof *c: 1
sizeof c: 8
As you can see, sizeof *c
returns the size of the "structure" and sizeof c
returns the size of the pointer.
Thank you for your efforts. I appreciate that you took the time to look for problems!
from lwip-ftpd.
correct, and thanks, this script illustrates it clearly
#include <stdio.h>
#include <stdlib.h>
typedef struct el {
char m[234];
} el_t;
int main(unsigned int argc, char **argv)
{
el_t *c = malloc(sizeof(*c));
printf("sizeof *c: %d\n", sizeof (*c));
printf("sizeof c: %d\n", sizeof (c));
el_t *p = malloc(sizeof(el_t));
printf("sizeof *p: %d\n", sizeof (*p));
printf("sizeof p: %d\n", sizeof (p));
}
C:\tmp>gcc -o test test.c
C:\tmp>test
sizeof *c: 234
sizeof c: 8
sizeof *p: 234
sizeof p: 8
from lwip-ftpd.
Related Issues (16)
- ftpd hangs after LIST command HOT 4
- Memory leak after client quits session HOT 3
- Having problems with '0:\' drive/LUN designator HOT 10
- Passive Mode HOT 4
- len wrapped rcv_wnd HOT 1
- re-use of free'd memory causes hard crash
- missing call to f_closedir() HOT 1
- Does not work with FileZilla on windows HOT 3
- Memory leak?
- ftpd hangs on cmd_pasv
- Trouble getting ftpd to run HOT 5
- Directory listing extremely slow HOT 5
- send_next_directory limitation HOT 4
- send_next_directory hangs the client HOT 3
- vfs_close deletes guard_for_the_whole_fs HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from lwip-ftpd.