struct stat st;\r
FILE *f;\r
\r
- if (ms->data) free(ms->data);\r
+ if (ms->data && ms->flag) free(ms->data);\r
ms->data = NULL;\r
\r
switch (ms->name[0]) {\r
HANDLE h = FindResource(hInst, ms->name + 1, "WAVE");\r
if (h == NULL) break;\r
ms->data = (void *)LoadResource(hInst, h);\r
+ ms->flag = 0; // not maloced, so cannot be freed!\r
if (h == NULL) break;\r
ok = TRUE;\r
}\r
if (f == NULL) break;\r
if (fstat(fileno(f), &st) < 0) break;\r
ms->data = malloc(st.st_size);\r
+ ms->flag = 1;\r
if (fread(ms->data, st.st_size, 1, f) < 1) break;\r
fclose(f);\r
ok = TRUE;\r